TryGetTile no longer returns a value if width is outside the map

This commit is contained in:
Patrick Kranz
2022-01-19 20:53:20 +01:00
parent 1d8ea44edf
commit f139d7d0eb
@@ -28,6 +28,11 @@ namespace MonoGame.Extended.Tiled
public bool TryGetTile(ushort x, ushort y, out TiledMapTile? tile)
{
if (x >= Width)
{
tile = null;
return false;
}
var index = GetTileIndex(x, y);
if (index < 0 || index >= Tiles.Length)
@@ -57,4 +62,4 @@ namespace MonoGame.Extended.Tiled
SetTile(x, y, 0);
}
}
}
}