Merge pull request #77440 from KoBeWi/set_pattern_which_doesn't_exist

Check for null in `set_pattern()`
This commit is contained in:
Rémi Verschelde 2023-05-24 18:36:56 +02:00
commit 4c677c88e9
No known key found for this signature in database
GPG Key ID: C3336907360768E1

View File

@ -2334,7 +2334,8 @@ Vector2i TileMap::map_pattern(const Vector2i &p_position_in_tilemap, const Vecto
void TileMap::set_pattern(int p_layer, const Vector2i &p_position, const Ref<TileMapPattern> p_pattern) {
ERR_FAIL_INDEX(p_layer, (int)layers.size());
ERR_FAIL_COND(!tile_set.is_valid());
ERR_FAIL_COND(tile_set.is_null());
ERR_FAIL_COND(p_pattern.is_null());
TypedArray<Vector2i> used_cells = p_pattern->get_used_cells();
for (int i = 0; i < used_cells.size(); i++) {