aboutsummaryrefslogtreecommitdiff
path: root/engines/sci
diff options
context:
space:
mode:
Diffstat (limited to 'engines/sci')
-rw-r--r--engines/sci/engine/segment.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/engines/sci/engine/segment.cpp b/engines/sci/engine/segment.cpp
index 9f934a3f1d..991a56a8cf 100644
--- a/engines/sci/engine/segment.cpp
+++ b/engines/sci/engine/segment.cpp
@@ -264,7 +264,10 @@ SegmentRef LocalVariables::dereference(reg_t pointer) {
SegmentRef ret;
ret.isRaw = false; // reg_t based data!
ret.maxSize = (_locals.size() - pointer.offset/2) * 2;
- ret.raw = (byte *)&_locals[pointer.offset/2];
+ if (ret.maxSize > 0)
+ ret.raw = (byte *)&_locals[pointer.offset/2];
+ else
+ warning("LocalVariables::dereference: Offset at end or out of bounds %04x:%04x", PRINT_REG(pointer));
return ret;
}