diff --git a/src/TSMapEditor/Mutations/Classes/HeightMutations/LowerCellsMutation.cs b/src/TSMapEditor/Mutations/Classes/HeightMutations/LowerCellsMutation.cs index 3b0f4a99..2985b0ef 100644 --- a/src/TSMapEditor/Mutations/Classes/HeightMutations/LowerCellsMutation.cs +++ b/src/TSMapEditor/Mutations/Classes/HeightMutations/LowerCellsMutation.cs @@ -45,6 +45,10 @@ public override void Perform() else { var targetTile = MutationTarget.Map.GetTile(targetCellCoords); + + if (targetTile == null || targetTile.Level <= 0) + return; + var tilesToProcess = Helpers.GetFillAreaTiles(targetTile, MutationTarget.Map, MutationTarget.TheaterGraphics); // Process tiles diff --git a/src/TSMapEditor/Mutations/Classes/HeightMutations/RaiseCellsMutation.cs b/src/TSMapEditor/Mutations/Classes/HeightMutations/RaiseCellsMutation.cs index 6251103a..82253d4d 100644 --- a/src/TSMapEditor/Mutations/Classes/HeightMutations/RaiseCellsMutation.cs +++ b/src/TSMapEditor/Mutations/Classes/HeightMutations/RaiseCellsMutation.cs @@ -46,6 +46,10 @@ public override void Perform() else { var targetTile = MutationTarget.Map.GetTile(targetCellCoords); + + if (targetTile == null || targetTile.Level >= Constants.MaxMapHeightLevel) + return; + var tilesToProcess = Helpers.GetFillAreaTiles(targetTile, MutationTarget.Map, MutationTarget.TheaterGraphics); // Process tiles