Validate TileData enum range before using it as index

This commit is contained in:
Haoyu Qiu 2021-08-02 22:49:23 +08:00
parent b9d544b404
commit 091d802692

View file

@ -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) { 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(terrain_set < 0);
ERR_FAIL_COND(p_terrain_index < -1); ERR_FAIL_COND(p_terrain_index < -1);
if (tile_set) { if (tile_set) {