aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Sandulenko2019-12-30 22:53:16 +0100
committerEugene Sandulenko2019-12-30 22:53:16 +0100
commit825122f49411d1edfddd856ac45d14c485090f47 (patch)
tree0c3a2e8760ab74665e61a45488694de550b8909c
parent4a4819d7dfd4607a79c7f029398d20cf3f01b8e1 (diff)
downloadscummvm-rg350-825122f49411d1edfddd856ac45d14c485090f47.tar.gz
scummvm-rg350-825122f49411d1edfddd856ac45d14c485090f47.tar.bz2
scummvm-rg350-825122f49411d1edfddd856ac45d14c485090f47.zip
DIRECTOR: Do not crash on unhandled casts
-rw-r--r--engines/director/score.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index 9e40f0f62a..b078382513 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -722,8 +722,9 @@ void Score::loadCastData(Common::SeekableSubReadStreamEndian &stream, uint16 id,
break;
}
- for (uint child = 0; child < res->children.size(); child++)
- _loadedCast->getVal(id)->_children.push_back(res->children[child]);
+ if (_loadedCast->contains(id)) // Skip unhandled casts
+ for (uint child = 0; child < res->children.size(); child++)
+ _loadedCast->getVal(id)->_children.push_back(res->children[child]);
free(data);