Fixes crash in TileSetAtlasSource::get_tiles_to_be_removed_on_change

This commit is contained in:
Gilles Roudière 2021-10-14 16:48:03 +02:00
parent bf322bacdd
commit 3948f9cc83
1 changed files with 4 additions and 0 deletions

View File

@ -3565,6 +3565,10 @@ bool TileSetAtlasSource::has_room_for_tile(Vector2i p_atlas_coords, Vector2i p_s
}
PackedVector2Array TileSetAtlasSource::get_tiles_to_be_removed_on_change(Ref<Texture2D> p_texture, Vector2i p_margins, Vector2i p_separation, Vector2i p_texture_region_size) {
ERR_FAIL_COND_V(p_margins.x < 0 || p_margins.y < 0, PackedVector2Array());
ERR_FAIL_COND_V(p_separation.x < 0 || p_separation.y < 0, PackedVector2Array());
ERR_FAIL_COND_V(p_texture_region_size.x <= 0 || p_texture_region_size.y <= 0, PackedVector2Array());
// Compute the new atlas grid size.
Size2 new_grid_size;
if (p_texture.is_valid()) {