From eb22ea3b96b4e76b6ac717490d33abbb314acb62 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Wed, 14 May 2003 20:14:03 +0000 Subject: additional readArray protection (might cause regression in FT, but then we should fix FT!) svn-id: r7512 --- scumm/script_v6.cpp | 7 +++++-- 1 file 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]; -- cgit v1.2.3