[Scummvm-cvs-logs] SF.net SVN: scummvm:[42201] scummvm/trunk/engines/sci

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Tue Jul 7 08:53:54 CEST 2009


Revision: 42201
          http://scummvm.svn.sourceforge.net/scummvm/?rev=42201&view=rev
Author:   thebluegr
Date:     2009-07-07 06:53:53 +0000 (Tue, 07 Jul 2009)

Log Message:
-----------
Prevent a crash when the engine errors out before the game state is initialized

Modified Paths:
--------------
    scummvm/trunk/engines/sci/console.cpp
    scummvm/trunk/engines/sci/sci.cpp

Modified: scummvm/trunk/engines/sci/console.cpp
===================================================================
--- scummvm/trunk/engines/sci/console.cpp	2009-07-07 06:29:07 UTC (rev 42200)
+++ scummvm/trunk/engines/sci/console.cpp	2009-07-07 06:53:53 UTC (rev 42201)
@@ -201,12 +201,14 @@
 }
 
 void Console::preEnter() {
-	_vm->_gamestate->_sound.sfx_suspend(true);
+	if (_vm->_gamestate)
+		_vm->_gamestate->_sound.sfx_suspend(true);
 	_vm->_mixer->pauseAll(true);
 }
 
 void Console::postEnter() {
-	_vm->_gamestate->_sound.sfx_suspend(false);
+	if (_vm->_gamestate)
+		_vm->_gamestate->_sound.sfx_suspend(false);
 	_vm->_mixer->pauseAll(false);
 }
 

Modified: scummvm/trunk/engines/sci/sci.cpp
===================================================================
--- scummvm/trunk/engines/sci/sci.cpp	2009-07-07 06:29:07 UTC (rev 42200)
+++ scummvm/trunk/engines/sci/sci.cpp	2009-07-07 06:53:53 UTC (rev 42201)
@@ -89,6 +89,8 @@
 	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 @@
 
 // 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;
 }


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list