SCI32: Fix restoring games from Torin's game restore dialog

The list in kListEachElementDo may be invalidated after a
selector invocation
This commit is contained in:
Filippos Karapetis 2016-08-23 11:36:04 +03:00
parent cd00132d23
commit 3d1f1a3a21

View file

@ -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]);