From: Holger Schemel Date: Tue, 17 Apr 2018 17:49:13 +0000 (+0200) Subject: added check to prevent crash when drawing sprites for undefined graphics X-Git-Tag: 4.1.1.0~197 X-Git-Url: https://git.artsoft.org/?p=rocksndiamonds.git;a=commitdiff_plain;h=c30edbbd22c95dc165311601b15d5370e134fbf8 added check to prevent crash when drawing sprites for undefined graphics Due to a bug (that will be fixed with the following commit) it may be possible that game elements are drawn for undefined graphics ID, resulting in a crash. A check was added to prevent drawing sprites for undefined graphics. --- diff --git a/src/game_sp/DDSpriteBuffer.c b/src/game_sp/DDSpriteBuffer.c index 261459ad..e4be4164 100644 --- a/src/game_sp/DDSpriteBuffer.c +++ b/src/game_sp/DDSpriteBuffer.c @@ -37,6 +37,9 @@ void DDSpriteBuffer_BltImg(int pX, int pY, int graphic, int sync_frame) if (NoDisplayFlag) return; + if (graphic < 0) + return; + getGraphicSource_SP(&g, graphic, sync_frame, -1, -1); Blt(pX, pY, g.bitmap, g.src_x, g.src_y);