diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2023-01-16 12:49:32 +0100 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2023-01-16 12:49:32 +0100 |
commit | 7c00fdcf5d915e413ae387f1f7bd7ad913a01acc (patch) | |
tree | bcadbb5274e8c9f9c353ef0a2c5349d182f4bbf9 /scene/resources/tile_set.cpp | |
parent | 5ca6c1f9dbb38722f206bf5e03aab1e09cae526d (diff) | |
parent | 0dbcf8f735c4cc29312582f3b2b4046581c36886 (diff) |
Merge pull request #71507 from groud/fix_add_source_source_id
Fix TileDate::add_source accepting invalid ID values
Diffstat (limited to 'scene/resources/tile_set.cpp')
-rw-r--r-- | scene/resources/tile_set.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/scene/resources/tile_set.cpp b/scene/resources/tile_set.cpp index 4043b73b71..94e78fc3aa 100644 --- a/scene/resources/tile_set.cpp +++ b/scene/resources/tile_set.cpp @@ -473,6 +473,7 @@ void TileSet::_compute_next_source_id() { int TileSet::add_source(Ref<TileSetSource> p_tile_set_source, int p_atlas_source_id_override) { ERR_FAIL_COND_V(!p_tile_set_source.is_valid(), TileSet::INVALID_SOURCE); ERR_FAIL_COND_V_MSG(p_atlas_source_id_override >= 0 && (sources.has(p_atlas_source_id_override)), TileSet::INVALID_SOURCE, vformat("Cannot create TileSet atlas source. Another atlas source exists with id %d.", p_atlas_source_id_override)); + ERR_FAIL_COND_V_MSG(p_atlas_source_id_override < 0 && p_atlas_source_id_override != TileSet::INVALID_SOURCE, TileSet::INVALID_SOURCE, vformat("Provided source ID %d is not valid. Negative source IDs are not allowed.", p_atlas_source_id_override)); int new_source_id = p_atlas_source_id_override >= 0 ? p_atlas_source_id_override : next_source_id; sources[new_source_id] = p_tile_set_source; |