diff options
author | Paul Gilbert | 2016-11-13 16:07:16 -0500 |
---|---|---|
committer | Paul Gilbert | 2016-11-13 16:07:16 -0500 |
commit | f1db69d422ed93324633808763e8dbe8f09e5380 (patch) | |
tree | fbe1a00cfe4da4d2365e6dd3fa4c1522d81d6779 /engines/titanic/true_talk | |
parent | 66eb358ded6c9269c334bf169a4c9cf79cc31c47 (diff) | |
download | scummvm-rg350-f1db69d422ed93324633808763e8dbe8f09e5380.tar.gz scummvm-rg350-f1db69d422ed93324633808763e8dbe8f09e5380.tar.bz2 scummvm-rg350-f1db69d422ed93324633808763e8dbe8f09e5380.zip |
TITANIC: Fix crash in setConcept when src is null
Diffstat (limited to 'engines/titanic/true_talk')
-rw-r--r-- | engines/titanic/true_talk/tt_concept_node.cpp | 52 |
1 files changed, 27 insertions, 25 deletions
diff --git a/engines/titanic/true_talk/tt_concept_node.cpp b/engines/titanic/true_talk/tt_concept_node.cpp index f6512b3d81..ccba1b81bb 100644 --- a/engines/titanic/true_talk/tt_concept_node.cpp +++ b/engines/titanic/true_talk/tt_concept_node.cpp @@ -86,32 +86,34 @@ TTconcept **TTconceptNode::setConcept(int conceptIndex, TTconcept *src) { break; } - bool isPronoun = false; - StringArray &pronouns = g_vm->_scriptHandler->_parser._pronouns; - for (uint idx = 0; idx < pronouns.size() && !isPronoun; ++idx) { - isPronoun = pronouns[idx] == src->getText(); - } + if (src) { + bool isPronoun = false; + StringArray &pronouns = g_vm->_scriptHandler->_parser._pronouns; + for (uint idx = 0; idx < pronouns.size() && !isPronoun; ++idx) { + isPronoun = pronouns[idx] == src->getText(); + } - CScriptHandler &scrHandler = *g_vm->_exeResources._owner; - if (!isPronoun) { - switch (conceptIndex) { - case 0: - delete scrHandler._concept2P; - scrHandler._concept2P = new TTconcept(*src); - break; - - case 1: - delete scrHandler._concept4P; - scrHandler._concept4P = new TTconcept(*src); - break; - - case 2: - delete scrHandler._concept1P; - scrHandler._concept1P = new TTconcept(*src); - break; - - default: - break; + CScriptHandler &scrHandler = *g_vm->_exeResources._owner; + if (!isPronoun) { + switch (conceptIndex) { + case 0: + delete scrHandler._concept2P; + scrHandler._concept2P = new TTconcept(*src); + break; + + case 1: + delete scrHandler._concept4P; + scrHandler._concept4P = new TTconcept(*src); + break; + + case 2: + delete scrHandler._concept1P; + scrHandler._concept1P = new TTconcept(*src); + break; + + default: + break; + } } } |