From 2260447e8b7a960a7e92c6c75f0ec66c079581b6 Mon Sep 17 00:00:00 2001 From: Travis Howell Date: Sun, 1 May 2005 01:02:34 +0000 Subject: [PATCH] Add missing safety checks. svn-id: r17877 --- scumm/script_v100he.cpp | 6 ++++-- scumm/script_v72he.cpp | 12 ++++++++---- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/scumm/script_v100he.cpp b/scumm/script_v100he.cpp index 6210ce25226..eaa8a46fbfc 100644 --- a/scumm/script_v100he.cpp +++ b/scumm/script_v100he.cpp @@ -2779,8 +2779,10 @@ void ScummEngine_v100he::decodeParseString(int m, int n) { _string[m].loadDefault(); if (n) { _actorToPrintStrFor = pop(); - a = derefActorSafe(_actorToPrintStrFor, "decodeParseString"); - _string[0].color = a->_talkColor; + if (_actorToPrintStrFor != 0xFF) { + a = derefActorSafe(_actorToPrintStrFor, "decodeParseString"); + _string[0].color = a->_talkColor; + } } break; case 92: diff --git a/scumm/script_v72he.cpp b/scumm/script_v72he.cpp index 32742802691..de6bbb1062f 100644 --- a/scumm/script_v72he.cpp +++ b/scumm/script_v72he.cpp @@ -1570,10 +1570,12 @@ void ScummEngine_v72he::o72_talkActor() { Actor *a; _actorToPrintStrFor = pop(); - a = derefActorSafe(_actorToPrintStrFor, "o72_talkActor"); _string[0].loadDefault(); - _string[0].color = a->_talkColor; + if (_actorToPrintStrFor != 0xFF) { + a = derefActorSafe(_actorToPrintStrFor, "o72_talkActor"); + _string[0].color = a->_talkColor; + } actorTalk(_scriptPointer); _scriptPointer += resStrLen(_scriptPointer) + 1; @@ -2258,8 +2260,10 @@ void ScummEngine_v72he::decodeParseString(int m, int n) { _string[m].loadDefault(); if (n) { _actorToPrintStrFor = pop(); - a = derefActorSafe(_actorToPrintStrFor, "decodeParseString"); - _string[0].color = a->_talkColor; + if (_actorToPrintStrFor != 0xFF) { + a = derefActorSafe(_actorToPrintStrFor, "decodeParseString"); + _string[0].color = a->_talkColor; + } } break; case 0xFF: