Skip to content

Commit 60a6954

Browse files
committed
FIX: exit gracefully when Engine instance is null.
1 parent 6539b20 commit 60a6954

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

src/omega/omegaPythonApi.cpp

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -70,15 +70,17 @@ PyObject* omegaExit(PyObject* self, PyObject* args)
7070
{
7171
// Gracious exit code is broken.
7272
SystemManager::instance()->postExitRequest();
73-
74-
// Do it the control-C way (it always works)
75-
DisplaySystem* ds = SystemManager::instance()->getDisplaySystem();
76-
// Explicitly kill sound server
77-
SoundEnvironment* se = Engine::instance()->getSoundEnvironment();
78-
if(se != NULL)
73+
if(Engine::instance() != NULL)
7974
{
80-
se->getSoundManager()->stopAllSounds();
81-
se->getSoundManager()->cleanupAllSounds();
75+
// Do it the control-C way (it always works)
76+
DisplaySystem* ds = SystemManager::instance()->getDisplaySystem();
77+
// Explicitly kill sound server
78+
SoundEnvironment* se = Engine::instance()->getSoundEnvironment();
79+
if(se != NULL)
80+
{
81+
se->getSoundManager()->stopAllSounds();
82+
se->getSoundManager()->cleanupAllSounds();
83+
}
8284
}
8385
Py_INCREF(Py_None);
8486
return Py_None;

0 commit comments

Comments
 (0)