aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTorbjörn Andersson2010-09-20 00:02:12 +0000
committerTorbjörn Andersson2010-09-20 00:02:12 +0000
commit971d5ca4b82707b76d3cb70d6e5904c3cb9bb318 (patch)
tree23d18e47000727cd99c4aefa3c8cb20b44f0b0bc
parent965ec170cb019f48d31ee696568ca21d125f33af (diff)
downloadscummvm-rg350-971d5ca4b82707b76d3cb70d6e5904c3cb9bb318.tar.gz
scummvm-rg350-971d5ca4b82707b76d3cb70d6e5904c3cb9bb318.tar.bz2
scummvm-rg350-971d5ca4b82707b76d3cb70d6e5904c3cb9bb318.zip
GOB: Don't crash if getCharData() returns NULL
This happened to me when playing the floppy version of Gobliins 2. I don't know if it's a fix or a workaround, but the function can clearly return NULL so let's guard against it. svn-id: r52813
-rw-r--r--engines/gob/driver_vga.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/engines/gob/driver_vga.cpp b/engines/gob/driver_vga.cpp
index c93962c206..7be1daf9f3 100644
--- a/engines/gob/driver_vga.cpp
+++ b/engines/gob/driver_vga.cpp
@@ -75,6 +75,16 @@ void VGAVideoDriver::drawLetter(unsigned char item, int16 x, int16 y,
uint16 data;
const byte *src = font.getCharData(item);
+
+ // This happens for me at the mountain (World 6) in Gobliins 2, if I
+ // move the cursor over the "!" part of the ledge while trying to use
+ // an object.
+
+ if (!src) {
+ warning("drawLetter: getCharData() returned NULL");
+ return;
+ }
+
byte *dst = dest.getVidMem() + x + dest.getWidth() * y;
int nWidth = font.getCharWidth();