aboutsummaryrefslogtreecommitdiff
path: root/engines/sci
diff options
context:
space:
mode:
authorDan Church2018-01-02 12:11:32 -0600
committerColin Snover2018-01-02 12:57:59 -0600
commit0c26da90bb7538fb8bbf866013993185467b194b (patch)
treec0b6a90e53429112666fa684319fedc2828fd564 /engines/sci
parent6e2c702badcba7e3f16342d61436036353453f24 (diff)
downloadscummvm-rg350-0c26da90bb7538fb8bbf866013993185467b194b.tar.gz
scummvm-rg350-0c26da90bb7538fb8bbf866013993185467b194b.tar.bz2
scummvm-rg350-0c26da90bb7538fb8bbf866013993185467b194b.zip
SCI32: Fix segfault when SCI3 vocab isn't found
Seen when attempting to detect and/or run the Shivers 2 demo. Closes gh-1106.
Diffstat (limited to 'engines/sci')
-rw-r--r--engines/sci/resource.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/engines/sci/resource.cpp b/engines/sci/resource.cpp
index eb786bce03..78b641c9de 100644
--- a/engines/sci/resource.cpp
+++ b/engines/sci/resource.cpp
@@ -2918,6 +2918,9 @@ Common::String ResourceManager::findSierraGameId(const bool isBE) {
heap = findResource(ResourceId(kResourceTypeScript, 0), false);
Resource *vocab = findResource(ResourceId(kResourceTypeVocab, VOCAB_RESOURCE_SELECTORS), false);
+ if (!vocab)
+ return "";
+
const uint16 numSelectors = isBE ? vocab->getUint16BEAt(0) : vocab->getUint16LEAt(0);
for (uint16 i = 0; i < numSelectors; ++i) {
uint16 selectorOffset;