From 89c39c7f9d28345f01cfa3be667efd893f2d32ed Mon Sep 17 00:00:00 2001 From: HolonProduction Date: Tue, 18 Jul 2023 17:52:32 +0200 Subject: [PATCH] Fix crash when deleting terrains --- scene/resources/tile_set.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scene/resources/tile_set.cpp b/scene/resources/tile_set.cpp index 19f57dda003..f340573c6a2 100644 --- a/scene/resources/tile_set.cpp +++ b/scene/resources/tile_set.cpp @@ -5116,6 +5116,8 @@ void TileData::remove_terrain(int p_terrain_set, int p_index) { if (terrain_set == p_terrain_set) { if (terrain == p_index) { terrain = -1; + } else if (terrain > p_index) { + terrain -= 1; } for (int i = 0; i < 16; i++) {