aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/sherlock/fonts.cpp11
-rw-r--r--engines/sherlock/talk.cpp2
2 files changed, 9 insertions, 4 deletions
diff --git a/engines/sherlock/fonts.cpp b/engines/sherlock/fonts.cpp
index 482e795b6d..b607891d06 100644
--- a/engines/sherlock/fonts.cpp
+++ b/engines/sherlock/fonts.cpp
@@ -147,10 +147,13 @@ void Fonts::writeString(Surface *surface, const Common::String &str,
}
curChar = translateChar(curChar);
- assert(curChar < _charCount);
- ImageFrame &frame = (*_font)[curChar];
- surface->transBlitFrom(frame, Common::Point(charPos.x, charPos.y + _yOffsets[curChar]), false, overrideColor);
- charPos.x += frame._frame.w + 1;
+ if (curChar < _charCount) {
+ ImageFrame &frame = (*_font)[curChar];
+ surface->transBlitFrom(frame, Common::Point(charPos.x, charPos.y + _yOffsets[curChar]), false, overrideColor);
+ charPos.x += frame._frame.w + 1;
+ } else {
+ warning("Invalid character encountered - %d", (int)curChar);
+ }
}
}
diff --git a/engines/sherlock/talk.cpp b/engines/sherlock/talk.cpp
index e399c268ed..4150835fb8 100644
--- a/engines/sherlock/talk.cpp
+++ b/engines/sherlock/talk.cpp
@@ -915,6 +915,8 @@ bool Talk::isOpcode(byte checkCharacter) {
}
bool Talk::isPossibleOpcode(byte checkCharacter) {
+ // Some conversations in the Spanish version, such as the first conversation with Lastrade,
+ // start with an invalid character. Hence isPossibleOpcode being separate from isOpcode
if (IS_SERRATED_SCALPEL && _vm->getLanguage() == Common::ES_ESP)
return checkCharacter >= 128;