From ec680ef8aad8e82a14eb5a2af59fb72284919722 Mon Sep 17 00:00:00 2001 From: Florian Kagerer Date: Sun, 31 Oct 2010 00:20:30 +0000 Subject: [PATCH] LOL: fixed bug #3099321 (Crash in Yvel tavern basement) svn-id: r53973 --- engines/kyra/screen_v2.cpp | 6 ++++++ engines/kyra/sprites_lol.cpp | 3 +++ 2 files changed, 9 insertions(+) diff --git a/engines/kyra/screen_v2.cpp b/engines/kyra/screen_v2.cpp index 4d90bf2babb..9c224d15628 100644 --- a/engines/kyra/screen_v2.cpp +++ b/engines/kyra/screen_v2.cpp @@ -187,16 +187,22 @@ uint8 *Screen_v2::getPtrToShape(uint8 *shpFile, int shape) { } int Screen_v2::getShapeScaledWidth(const uint8 *shpFile, int scale) { + if (!shpFile) + return 0; int width = READ_LE_UINT16(shpFile+3); return (width * scale) >> 8; } int Screen_v2::getShapeScaledHeight(const uint8 *shpFile, int scale) { + if (!shpFile) + return 0; int height = shpFile[2]; return (height * scale) >> 8; } uint16 Screen_v2::getShapeSize(const uint8 *shp) { + if (!shp) + return 0; return READ_LE_UINT16(shp+6); } diff --git a/engines/kyra/sprites_lol.cpp b/engines/kyra/sprites_lol.cpp index d1992762355..6245ecdd1f7 100644 --- a/engines/kyra/sprites_lol.cpp +++ b/engines/kyra/sprites_lol.cpp @@ -901,6 +901,9 @@ void LoLEngine::calcSpriteRelPosition(uint16 x1, uint16 y1, int &x2, int &y2, ui } void LoLEngine::drawDoor(uint8 *shape, uint8 *doorPalette, int index, int unk2, int w, int h, int flags) { + if (!shape) + return; + uint8 c = _dscDoor1[(_currentDirection << 5) + unk2]; int r = (c / 5) + 5 * _dscDimMap[index]; uint16 d = _dscShapeOvlIndex[r];