From c30edbbd22c95dc165311601b15d5370e134fbf8 Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Tue, 17 Apr 2018 19:49:13 +0200 Subject: [PATCH] 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. --- src/game_sp/DDSpriteBuffer.c | 3 +++ 1 file changed, 3 insertions(+) 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); -- 2.34.1