fixed crash bug caused by accessing invalid (off-playfield) array positions
[rocksndiamonds.git] / src / tools.c
index 6a998afb360639bb7611ac472c06ff6b0c7bf497..9fe777c90e0f0b180ff7c6ea1936f83176fb11ae 100644 (file)
@@ -1506,7 +1506,9 @@ int getGraphicAnimationFrameXY(int graphic, int lx, int ly)
     return sync_frame % g->anim_frames;
   }
 
-  return getGraphicAnimationFrame(graphic, GfxFrame[lx][ly]);
+  int sync_frame = (IN_LEV_FIELD(lx, ly) ? GfxFrame[lx][ly] : -1);
+
+  return getGraphicAnimationFrame(graphic, sync_frame);
 }
 
 void getGraphicSourceBitmap(int graphic, int tilesize, Bitmap **bitmap)