aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorPaul Gilbert2018-04-06 21:05:40 -0400
committerPaul Gilbert2018-04-06 21:05:40 -0400
commit9d94d97cc60006eac16808c14efdff85fd17f910 (patch)
treeebd47a35faee600134e05daed727eaa833828457 /engines
parent4586cee0ab61aa7eaf93f7ec9777d1c750a91ab2 (diff)
downloadscummvm-rg350-9d94d97cc60006eac16808c14efdff85fd17f910.tar.gz
scummvm-rg350-9d94d97cc60006eac16808c14efdff85fd17f910.tar.bz2
scummvm-rg350-9d94d97cc60006eac16808c14efdff85fd17f910.zip
XEEN: Fix crash getting Scarab of Imaging
Diffstat (limited to 'engines')
-rw-r--r--engines/xeen/scripts.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/engines/xeen/scripts.cpp b/engines/xeen/scripts.cpp
index 82d53040c1..92204fc5ac 100644
--- a/engines/xeen/scripts.cpp
+++ b/engines/xeen/scripts.cpp
@@ -214,7 +214,7 @@ int Scripts::checkEvents() {
MazeObject &selectedObj = map._mobData._objects[intf._objNumber];
if (selectedObj._spriteId == (ccNum ? 15 : 16)) {
- for (uint idx = 0; idx < 16; ++idx) {
+ for (uint idx = 0; idx < MIN((int)map._mobData._objects.size(), 16); ++idx) {
MazeObject &obj = map._mobData._objects[idx];
if (obj._spriteId == (ccNum ? 62 : 57)) {
selectedObj._id = idx;
@@ -223,7 +223,7 @@ int Scripts::checkEvents() {
}
}
} else if (selectedObj._spriteId == 73) {
- for (uint idx = 0; idx < 16; ++idx) {
+ for (uint idx = 0; idx < MIN((int)map._mobData._objects.size(), 16); ++idx) {
MazeObject &obj = map._mobData._objects[idx];
if (obj._spriteId == 119) {
selectedObj._id = idx;