diff options
author | Filippos Karapetis | 2009-07-07 06:53:53 +0000 |
---|---|---|
committer | Filippos Karapetis | 2009-07-07 06:53:53 +0000 |
commit | 2e3419c8cb22a686446777b45042436b5098c47f (patch) | |
tree | f365ef9804fa70ffa13455bab9f75b2e3fd6c75c /engines/sci/sci.cpp | |
parent | 0a8cd4a27d1b9ad7974697d6524b3455290f8990 (diff) | |
download | scummvm-rg350-2e3419c8cb22a686446777b45042436b5098c47f.tar.gz scummvm-rg350-2e3419c8cb22a686446777b45042436b5098c47f.tar.bz2 scummvm-rg350-2e3419c8cb22a686446777b45042436b5098c47f.zip |
Prevent a crash when the engine errors out before the game state is initialized
svn-id: r42201
Diffstat (limited to 'engines/sci/sci.cpp')
-rw-r--r-- | engines/sci/sci.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/engines/sci/sci.cpp b/engines/sci/sci.cpp index 0826509a8b..fb5356ba64 100644 --- a/engines/sci/sci.cpp +++ b/engines/sci/sci.cpp @@ -89,6 +89,8 @@ SciEngine::SciEngine(OSystem *syst, const SciGameDescription *desc) Common::addDebugChannel(kDebugLevelScripts, "Scripts", "Notifies when scripts are unloaded"); Common::addDebugChannel(kDebugLevelGC, "GC", "Garbage Collector debugging"); + _gamestate = 0; + printf("SciEngine::SciEngine\n"); } @@ -251,11 +253,14 @@ Common::Error SciEngine::run() { // Invoked by error() when a severe error occurs GUI::Debugger *SciEngine::getDebugger() { - ExecStack *xs = &(_gamestate->_executionStack.back()); + if (_gamestate) { + ExecStack *xs = &(_gamestate->_executionStack.back()); + xs->addr.pc.offset = debugState.old_pc_offset; + xs->sp = debugState.old_sp; + } + debugState.runningStep = 0; // Stop multiple execution debugState.seeking = kDebugSeekNothing; // Stop special seeks - xs->addr.pc.offset = debugState.old_pc_offset; - xs->sp = debugState.old_sp; return _console; } |