diff options
| -rw-r--r-- | engines/director/lingo/lingo-codegen.cpp | 7 | 
1 files changed, 6 insertions, 1 deletions
diff --git a/engines/director/lingo/lingo-codegen.cpp b/engines/director/lingo/lingo-codegen.cpp index 07f733f9ca..2be88487d7 100644 --- a/engines/director/lingo/lingo-codegen.cpp +++ b/engines/director/lingo/lingo-codegen.cpp @@ -53,7 +53,7 @@  namespace Director {  void Lingo::execute(uint pc) { -	for(_pc = pc; (*_currentScript)[_pc] != STOP && !_returning;) { +	for (_pc = pc; !_returning && (*_currentScript)[_pc] != STOP;) {  		Common::String instr = decodeInstruction(_pc);  		if (debugChannelSet(5, kDebugLingoExec)) @@ -66,6 +66,11 @@ void Lingo::execute(uint pc) {  		if (debugChannelSet(5, kDebugLingoExec))  			printStack("Stack after: "); + +		if (_pc >= (*_currentScript).size()) { +			warning("Lingo::execute(): Bad PC (%d)", _pc); +			break; +		}  	}  }  | 
