Skip to content

Commit f181839

Browse files
committed
fix crash
1 parent aa629df commit f181839

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

Framework/Intersect.Framework.Core/GameObjects/Maps/MapAutotiles.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3185,8 +3185,16 @@ private int CalculateCliffHeight(string layerName, int x, int y, MapBase[,] surr
31853185
var otherMap = surroundingMaps[gridX + 1, gridY + 1];
31863186
if (otherMap != null)
31873187
{
3188-
var otherMapLayers = otherMap.Layers;
3189-
var otherMapTiles = otherMapLayers[layerName];
3188+
if (otherMap.Layers is not { } otherMapLayers)
3189+
{
3190+
return 0;
3191+
}
3192+
3193+
if (!otherMapLayers.TryGetValue(layerName, out var otherMapTiles))
3194+
{
3195+
return 0;
3196+
}
3197+
31903198
sourceTile = otherMapTiles[x, y];
31913199
}
31923200

0 commit comments

Comments
 (0)