From: Holger Schemel Date: Tue, 8 Feb 2022 15:17:42 +0000 (+0100) Subject: fixed crash bug caused by accessing invalid (off-playfield) array positions X-Git-Tag: 4.3.1.1~3 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=b71e46505e5e3dc2213e67124dd1d245ca7a2cbb;p=rocksndiamonds.git 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. --- 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]);