aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFilippos Karapetis2016-08-23 11:36:04 +0300
committerFilippos Karapetis2016-08-23 11:36:38 +0300
commit3d1f1a3a21edd66f20f8de707ddcfcc8d97d13a6 (patch)
treef9bd64e16b4d0ec5f905d0d361e7700f4ff1c494
parentcd00132d230ebf9bf51d3d111ca889fe382e2ddb (diff)
downloadscummvm-rg350-3d1f1a3a21edd66f20f8de707ddcfcc8d97d13a6.tar.gz
scummvm-rg350-3d1f1a3a21edd66f20f8de707ddcfcc8d97d13a6.tar.bz2
scummvm-rg350-3d1f1a3a21edd66f20f8de707ddcfcc8d97d13a6.zip
SCI32: Fix restoring games from Torin's game restore dialog
The list in kListEachElementDo may be invalidated after a selector invocation
-rw-r--r--engines/sci/engine/klists.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/engines/sci/engine/klists.cpp b/engines/sci/engine/klists.cpp
index 53be26b37f..bc559148ac 100644
--- a/engines/sci/engine/klists.cpp
+++ b/engines/sci/engine/klists.cpp
@@ -576,6 +576,10 @@ reg_t kListEachElementDo(EngineState *s, int argc, reg_t *argv) {
}
} else {
invokeSelector(s, curObject, slc, argc, argv, argc - 2, argv + 2);
+ // Check if the list has been invalidated after the call above
+ // (e.g. when restoring in Torin)
+ if (s->_segMan->getSegmentType(argv[0].getSegment()) != SEG_TYPE_LISTS)
+ return s->r_acc;
}
curNode = s->_segMan->lookupNode(list->nextNodes[list->numRecursions]);