diff options
-rw-r--r-- | scumm/script_v6.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/scumm/script_v6.cpp b/scumm/script_v6.cpp index 6d2a664770..ed7b8caed4 100644 --- a/scumm/script_v6.cpp +++ b/scumm/script_v6.cpp @@ -393,7 +393,7 @@ int Scumm_v6::popRoomAndObj(int *room) { int Scumm::readArray(int array, int idx, int base) { ArrayHeader *ah = (ArrayHeader *)getResourceAddress(rtString, readVar(array)); - if (ah == NULL) { + if (ah == NULL || ah->data == NULL) { error("readArray: invalid array %d (%d)", array, readVar(array)); } @@ -401,7 +401,10 @@ int Scumm::readArray(int array, int idx, int base) { // FIXME: comment this for the time being as it was causing ft to crash // in the minefeild - //assert(base >= 0 && base < ah->dim1_size * ah->dim2_size); + // FIX THE FIXME: fixing an assert by commenting out is bad. It's evil. + // It's wrong. Find the proper cause, or at least, silently return + // from the function, but don't just go on overwriting memory! + assert(base >= 0 && base < ah->dim1_size * ah->dim2_size); if (ah->type == 4) { return ah->data[base]; |