fixed accessing array out of bounds
[rocksndiamonds.git] / src / game.c
index 97617bb336003beddee02f2b2f1d37b73ea81d49..3a2c1a11db4b5bf290f038fe0124b6d59faaf6a2 100644 (file)
@@ -1784,7 +1784,7 @@ static void InitPlayerField(int x, int y, int element, boolean init_game)
       player->active = TRUE;
 
       // remove potentially duplicate players
-      if (StorePlayer[jx][jy] == Tile[x][y])
+      if (IN_LEV_FIELD(jx, jy) && StorePlayer[jx][jy] == Tile[x][y])
        StorePlayer[jx][jy] = 0;
 
       StorePlayer[x][y] = Tile[x][y];