aboutsummaryrefslogtreecommitdiff
path: root/scumm
diff options
context:
space:
mode:
authorMax Horn2003-05-14 20:14:03 +0000
committerMax Horn2003-05-14 20:14:03 +0000
commiteb22ea3b96b4e76b6ac717490d33abbb314acb62 (patch)
treebfe59fc177d6c51c8314970b3f33c835d1711d68 /scumm
parentaf8cb44727c4cc7a00a0c652c661386c9c715775 (diff)
downloadscummvm-rg350-eb22ea3b96b4e76b6ac717490d33abbb314acb62.tar.gz
scummvm-rg350-eb22ea3b96b4e76b6ac717490d33abbb314acb62.tar.bz2
scummvm-rg350-eb22ea3b96b4e76b6ac717490d33abbb314acb62.zip
additional readArray protection (might cause regression in FT, but then we should fix FT!)
svn-id: r7512
Diffstat (limited to 'scumm')
-rw-r--r--scumm/script_v6.cpp7
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];