From 741aed5047eebc2991bed0e59462d1124b56a3ad Mon Sep 17 00:00:00 2001 From: Travis Howell Date: Sun, 10 Jun 2007 01:16:29 +0000 Subject: Fix crash via assert, when string for subtitles exists, but is only set to zero. svn-id: r27270 --- engines/agos/script_s1.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/engines/agos/script_s1.cpp b/engines/agos/script_s1.cpp index e104013cae..98b31d5c58 100644 --- a/engines/agos/script_s1.cpp +++ b/engines/agos/script_s1.cpp @@ -374,12 +374,12 @@ void AGOSEngine_Simon1::os1_screenTextMsg() { uint vgaSpriteId = getVarOrByte(); uint color = getVarOrByte(); uint stringId = getNextStringID(); - const byte *string_ptr = NULL; + const byte *stringPtr = NULL; uint speechId = 0; TextLocation *tl; if (stringId != 0xFFFF) - string_ptr = getStringPtrByID(stringId); + stringPtr = getStringPtrByID(stringId); if (getFeatures() & GF_TALKIE) { if (getGameType() == GType_FF || getGameType() == GType_PP) @@ -399,8 +399,8 @@ void AGOSEngine_Simon1::os1_screenTextMsg() { stopAnimateSimon2(2, vgaSpriteId + 2); } - if (string_ptr != NULL && (speechId == 0 || _subtitles)) - printScreenText(vgaSpriteId, color, (const char *)string_ptr, tl->x, tl->y, tl->width); + if (stringPtr != NULL && stringPtr[0] != 0 && (speechId == 0 || _subtitles)) + printScreenText(vgaSpriteId, color, (const char *)stringPtr, tl->x, tl->y, tl->width); } @@ -450,7 +450,7 @@ void AGOSEngine_Simon1::os1_screenTextPObj() { } stringPtr = buf; } - if (stringPtr != NULL) + if (stringPtr != NULL && stringPtr[0] != 0) printScreenText(vgaSpriteId, color, stringPtr, tl->x, tl->y, tl->width); } } @@ -512,7 +512,7 @@ void AGOSEngine_Simon1::os1_scnTxtLongText() { uint speechId = 0; TextLocation *tl; - const char *string_ptr = (const char *)getStringPtrByID(_longText[stringId]); + const char *stringPtr = (const char *)getStringPtrByID(_longText[stringId]); if (getFeatures() & GF_TALKIE) speechId = _longSound[stringId]; @@ -522,8 +522,8 @@ void AGOSEngine_Simon1::os1_scnTxtLongText() { if (_speech && speechId != 0) playSpeech(speechId, vgaSpriteId); - if (string_ptr != NULL && _subtitles) - printScreenText(vgaSpriteId, color, string_ptr, tl->x, tl->y, tl->width); + if (stringPtr != NULL && stringPtr[0] != 0 && _subtitles) + printScreenText(vgaSpriteId, color, stringPtr, tl->x, tl->y, tl->width); } void AGOSEngine_Simon1::os1_mouseOn() { -- cgit v1.2.3