Merge pull request #63427 from KoBeWi/metIeerT

Fix negative indices in TreeItem
This commit is contained in:
Rémi Verschelde 2022-07-26 07:45:37 +02:00 committed by GitHub
commit f2f1f079f0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -723,7 +723,12 @@ TreeItem *TreeItem::get_next_visible(bool p_wrap) {
TreeItem *TreeItem::get_child(int p_idx) {
_create_children_cache();
if (p_idx < 0) {
p_idx += children_cache.size();
}
ERR_FAIL_INDEX_V(p_idx, children_cache.size(), nullptr);
return children_cache.get(p_idx);
}