From b71e46505e5e3dc2213e67124dd1d245ca7a2cbb Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Tue, 8 Feb 2022 16:17:42 +0100 Subject: [PATCH] fixed crash bug caused by accessing invalid (off-playfield) array positions This bug caused accessing array "GfxElementEmpty[][]" out of bounds if level position is not inside the playfield. --- src/tools.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/tools.c b/src/tools.c index 0872e24b..6a998afb 100644 --- a/src/tools.c +++ b/src/tools.c @@ -1996,11 +1996,11 @@ void DrawScreenElementExt(int x, int y, int dx, int dy, int element, int graphic; int frame; - if (element == EL_EMPTY) - element = GfxElementEmpty[lx][ly]; - if (IN_LEV_FIELD(lx, ly)) { + if (element == EL_EMPTY) + element = GfxElementEmpty[lx][ly]; + SetRandomAnimationValue(lx, ly); graphic = el_act_dir2img(element, GfxAction[lx][ly], GfxDir[lx][ly]); -- 2.34.1