fixed crash bug caused by accessing invalid (off-playfield) array positions
[rocksndiamonds.git] / src / tools.c
index 0872e24bc1fde98a5459eff7dda8fff43ae68293..6a998afb360639bb7611ac472c06ff6b0c7bf497 100644 (file)
@@ -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]);