From dacbda3e6c42a8b5bd1cff2c55c4a1e95b7b61ab Mon Sep 17 00:00:00 2001 From: streepje8 Date: Sun, 30 Jun 2024 18:31:20 +0900 Subject: [PATCH] Added a bounds check that prevents the editor from crashing when tileset sizes mismatch --- Source/Plugins/Tilemaps/Core/Tilemaps/Tile.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Source/Plugins/Tilemaps/Core/Tilemaps/Tile.cs b/Source/Plugins/Tilemaps/Core/Tilemaps/Tile.cs index 20073212e..7dc049dc0 100644 --- a/Source/Plugins/Tilemaps/Core/Tilemaps/Tile.cs +++ b/Source/Plugins/Tilemaps/Core/Tilemaps/Tile.cs @@ -273,6 +273,10 @@ public static void UpdateAutoTileCon(Grid tileGrid, Grid updateMask, int tileY = y + beginY; int i = tileX + tileStride * tileY; + //Skip out of bounds tiles + if(i >= tiles.Length) continue; + if(tiles[i].BaseIndex >= tileData.Length) continue; + // Skip non-AutoTiles int autoTileIndex = tileData[tiles[i].BaseIndex].AutoTileLayer - 1; if (autoTileIndex == -1) continue;