summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHaoyu Qiu <timothyqiu32@gmail.com>2021-08-02 22:49:23 +0800
committerHaoyu Qiu <timothyqiu32@gmail.com>2021-08-02 22:49:23 +0800
commit091d8026926875cb6e50ea45f7661a16fd6af6f3 (patch)
tree08fee3faa712297321d3063590986d7438248570
parentb9d544b404bfcfbaf797b97b540961510595cd29 (diff)
Validate TileData enum range before using it as index
-rw-r--r--scene/resources/tile_set.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/scene/resources/tile_set.cpp b/scene/resources/tile_set.cpp
index 737b47ed95..e072720153 100644
--- a/scene/resources/tile_set.cpp
+++ b/scene/resources/tile_set.cpp
@@ -3817,6 +3817,7 @@ int TileData::get_terrain_set() const {
}
void TileData::set_peering_bit_terrain(TileSet::CellNeighbor p_peering_bit, int p_terrain_index) {
+ ERR_FAIL_INDEX(p_peering_bit, TileSet::CellNeighbor::CELL_NEIGHBOR_MAX);
ERR_FAIL_COND(terrain_set < 0);
ERR_FAIL_COND(p_terrain_index < -1);
if (tile_set) {