SCI: dont crash when scripts are trying to access invalid memory (fixes intro of lb2cd)

svn-id: r46718
This commit is contained in:
Martin Kiewitz 2009-12-29 21:37:26 +00:00
parent bca313c6fc
commit 3e5d8280fa

View File

@ -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;
}