aboutsummaryrefslogtreecommitdiff
path: root/engines/gob/draw_v1.cpp
diff options
context:
space:
mode:
authorSven Hesse2011-01-26 19:03:13 +0000
committerSven Hesse2011-01-26 19:03:13 +0000
commita2afc0f4d19f8eff5e9ebc49d51035970d4bcb8c (patch)
tree7127d56d027982fbc88a36b19e8397ea63a20f2c /engines/gob/draw_v1.cpp
parent2c2476b203c10699973950f08f6d8a4b3866408e (diff)
downloadscummvm-rg350-a2afc0f4d19f8eff5e9ebc49d51035970d4bcb8c.tar.gz
scummvm-rg350-a2afc0f4d19f8eff5e9ebc49d51035970d4bcb8c.tar.bz2
scummvm-rg350-a2afc0f4d19f8eff5e9ebc49d51035970d4bcb8c.zip
GOB: Check font index for kFontCount
svn-id: r55547
Diffstat (limited to 'engines/gob/draw_v1.cpp')
-rw-r--r--engines/gob/draw_v1.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/engines/gob/draw_v1.cpp b/engines/gob/draw_v1.cpp
index d130f424c2..e528b6ad86 100644
--- a/engines/gob/draw_v1.cpp
+++ b/engines/gob/draw_v1.cpp
@@ -247,8 +247,7 @@ void Draw_v1::printTotText(int16 id) {
if (*ptr != 0xBA) {
_letterToPrint = (char) *ptr;
spriteOperation(DRAW_DRAWLETTER);
- _destSpriteX +=
- _fonts[_fontIndex]->getCharWidth();
+ _destSpriteX += _fonts[_fontIndex]->getCharWidth();
ptr++;
} else {
cmd = ptrEnd[17] & 0x7F;
@@ -401,12 +400,12 @@ void Draw_v1::spriteOperation(int16 operation) {
break;
case DRAW_PRINTTEXT:
- font = _fonts[_fontIndex];
- if (!font) {
+ if ((_fontIndex >= kFontCount) || !_fonts[_fontIndex]) {
warning("Trying to print \"%s\" with undefined font %d", _textToPrint, _fontIndex);
break;
}
+ font = _fonts[_fontIndex];
len = strlen(_textToPrint);
dirtiedRect(_destSurface, _destSpriteX, _destSpriteY,
_destSpriteX + len * font->getCharWidth() - 1,
@@ -453,12 +452,12 @@ void Draw_v1::spriteOperation(int16 operation) {
break;
case DRAW_DRAWLETTER:
- font = _fonts[_fontIndex];
- if (!font) {
+ if ((_fontIndex >= kFontCount) || !_fonts[_fontIndex]) {
warning("Trying to print \'%c\' with undefined font %d", _letterToPrint, _fontIndex);
break;
}
+ font = _fonts[_fontIndex];
if (_fontToSprite[_fontIndex].sprite == -1) {
dirtiedRect(_destSurface, _destSpriteX, _destSpriteY,
_destSpriteX + font->getCharWidth() - 1,