double check that the sound manager has been created before using

This was SVN commit r13353.
This commit is contained in:
stwf 2013-04-10 12:03:17 +00:00
parent b301d5c84d
commit 0cad19ecec
2 changed files with 6 additions and 3 deletions

View File

@ -72,12 +72,14 @@ InReaction GlobalsInputHandler(const SDL_Event_* ev)
if(ev->ev.active.state & SDL_APPACTIVE)
{
g_app_minimized = (ev->ev.active.gain == 0); // negated
g_SoundManager->Pause( g_app_minimized && g_PauseOnFocusLoss && !g_NetClient );
if ( g_SoundManager )
g_SoundManager->Pause( g_app_minimized && g_PauseOnFocusLoss && !g_NetClient );
}
if(ev->ev.active.state & SDL_APPINPUTFOCUS)
{
g_app_has_focus = (ev->ev.active.gain != 0);
g_SoundManager->Pause( !g_app_has_focus && g_PauseOnFocusLoss && !g_NetClient );
if ( g_SoundManager )
g_SoundManager->Pause( !g_app_has_focus && g_PauseOnFocusLoss && !g_NetClient );
}
if(ev->ev.active.state & SDL_APPMOUSEFOCUS)
g_mouse_active = (ev->ev.active.gain != 0);

View File

@ -341,7 +341,8 @@ JSBool SetPaused(JSContext* cx, uintN argc, jsval* vp)
try
{
g_Game->m_Paused = ToPrimitive<bool> (JS_ARGV(cx, vp)[0]);
g_SoundManager->Pause(g_Game->m_Paused);
if ( g_SoundManager )
g_SoundManager->Pause(g_Game->m_Paused);
}
catch (PSERROR_Scripting_ConversionFailed)
{