diff options
author | Paul Gilbert | 2017-09-24 12:46:32 -0400 |
---|---|---|
committer | Paul Gilbert | 2017-09-24 12:46:32 -0400 |
commit | 5ab826f135524e81d3719ded11970b6b5753eb61 (patch) | |
tree | 297f761e613cd63cb61046ec79ea39ea2df81cce /engines | |
parent | a6026fc1fce636b9b8493e8f76b39cbd8406c8dc (diff) | |
download | scummvm-rg350-5ab826f135524e81d3719ded11970b6b5753eb61.tar.gz scummvm-rg350-5ab826f135524e81d3719ded11970b6b5753eb61.tar.bz2 scummvm-rg350-5ab826f135524e81d3719ded11970b6b5753eb61.zip |
TITANIC: Add some guards against using the game manager during game exit
Diffstat (limited to 'engines')
-rw-r--r-- | engines/titanic/core/game_object.cpp | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index d52fa27669..b6923c27a4 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -845,24 +845,34 @@ int CGameObject::addTimer(uint firstDuration, uint repeatDuration) { CTimeEventInfo *timer = new CTimeEventInfo(getTicksCount(), repeatDuration != 0, firstDuration, repeatDuration, this, 0, CString()); - getGameManager()->addTimer(timer); + CGameManager *gameMan = getGameManager(); + if (gameMan) + gameMan->addTimer(timer); return timer->_id; } void CGameObject::stopTimer(int id) { - getGameManager()->stopTimer(id); + CGameManager *gameMan = getGameManager(); + if (gameMan) + gameMan->stopTimer(id); } int CGameObject::startAnimTimer(const CString &action, uint firstDuration, uint repeatDuration) { - CTimeEventInfo *timer = new CTimeEventInfo(getTicksCount(), repeatDuration > 0, - firstDuration, repeatDuration, this, 0, action); - getGameManager()->addTimer(timer); + CGameManager *gameMan = getGameManager(); + if (gameMan) { + CTimeEventInfo *timer = new CTimeEventInfo(getTicksCount(), repeatDuration > 0, + firstDuration, repeatDuration, this, 0, action); + gameMan->addTimer(timer); + return timer->_id; + } - return timer->_id; + return -1; } void CGameObject::stopAnimTimer(int id) { - getGameManager()->stopTimer(id); + CGameManager *gameMan = getGameManager(); + if (gameMan) + gameMan->stopTimer(id); } void CGameObject::gotoView(const CString &viewName, const CString &clipName) { |