diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2021-06-13 10:44:04 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-13 10:44:04 +0200 |
commit | 2ed9bb7e42a33de174da21cd9a5daddae655be0e (patch) | |
tree | 367e4b85b0991a09346578199021522729e0b66f /scene/resources/tile_set.cpp | |
parent | 100305413434c39f851140cdaf17672481844b5d (diff) | |
parent | 43f9253c5388861fe8b05aba96d6ffcfda0e45f2 (diff) |
Merge pull request #49555 from timothyqiu/tileset-range
Add range check for TileSet::CellNeighbor parameter
Diffstat (limited to 'scene/resources/tile_set.cpp')
-rw-r--r-- | scene/resources/tile_set.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/scene/resources/tile_set.cpp b/scene/resources/tile_set.cpp index 2220df06f6..0d6f3c07f0 100644 --- a/scene/resources/tile_set.cpp +++ b/scene/resources/tile_set.cpp @@ -2454,6 +2454,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::CELL_NEIGHBOR_MAX); ERR_FAIL_COND(p_terrain_index < -1); if (tile_set) { ERR_FAIL_COND(p_terrain_index >= tile_set->get_terrains_count(terrain_set)); @@ -2464,6 +2465,7 @@ void TileData::set_peering_bit_terrain(TileSet::CellNeighbor p_peering_bit, int } int TileData::get_peering_bit_terrain(TileSet::CellNeighbor p_peering_bit) const { + ERR_FAIL_INDEX_V(p_peering_bit, TileSet::CELL_NEIGHBOR_MAX, -1); return terrain_peering_bits[p_peering_bit]; } |