Skip to content

Commit 88860e5

Browse files
committed
[[ Bug 13650 ]] Prevent a crash. This was introduced after the fix to bug 13569
1 parent 70d5935 commit 88860e5

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

engine/src/player-platform.cpp

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -964,8 +964,12 @@ void MCPlayer::open()
964964
{
965965
MCControl::open();
966966
prepare(MCnullstring);
967-
MCPlatformAttachPlayer(m_platform_player, getstack() -> getwindow());
968-
m_is_attached = true;;
967+
// PM-2014-10-15: [[ Bug 13650 ]] Check for nil to prevent a crash
968+
if (m_platform_player != nil)
969+
{
970+
MCPlatformAttachPlayer(m_platform_player, getstack() -> getwindow());
971+
m_is_attached = true;
972+
}
969973
}
970974

971975
void MCPlayer::close()
@@ -981,8 +985,12 @@ void MCPlayer::close()
981985
if (s_volume_popup != nil)
982986
s_volume_popup -> close();
983987

984-
MCPlatformDetachPlayer(m_platform_player);
985-
m_is_attached = false;
988+
// PM-2014-10-15: [[ Bug 13650 ]] Check for nil to prevent a crash
989+
if (m_platform_player != nil)
990+
{
991+
MCPlatformDetachPlayer(m_platform_player);
992+
m_is_attached = false;
993+
}
986994
}
987995

988996
Boolean MCPlayer::kdown(const char *string, KeySym key)

0 commit comments

Comments
 (0)