aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorFilippos Karapetis2013-01-08 23:07:22 +0200
committerFilippos Karapetis2013-01-08 23:13:38 +0200
commit796867cd32408aada11fc21323d5ee0ce201ffee (patch)
tree5ea4a472084ac03a62d3da120aa5774862a8a9b6 /engines
parenta7b72d0a9ad5c96665db7a130b195f1589164c95 (diff)
downloadscummvm-rg350-796867cd32408aada11fc21323d5ee0ce201ffee.tar.gz
scummvm-rg350-796867cd32408aada11fc21323d5ee0ce201ffee.tar.bz2
scummvm-rg350-796867cd32408aada11fc21323d5ee0ce201ffee.zip
TOLTECS: Fix script bug #3599964 - "TOLTECS: Crash when entering cave"
Diffstat (limited to 'engines')
-rw-r--r--engines/toltecs/script.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/engines/toltecs/script.cpp b/engines/toltecs/script.cpp
index f5e3f8481f..9ea95a2cd1 100644
--- a/engines/toltecs/script.cpp
+++ b/engines/toltecs/script.cpp
@@ -252,9 +252,12 @@ void ScriptInterpreter::execOpcode(byte opcode) {
// ok
_subCode = _code;
byte length = readByte();
+ if (length == 0) {
+ warning("Possible script bug detected - opcode length is 0 when calling script function");
+ return;
+ }
debug(2, "length = %d", length);
uint16 index = readInt16();
- debug(2, "callScriptFunction %d", index);
execScriptFunction(index);
_code += length - 2;
break;