Fix negative indices in TreeItem

This commit is contained in:
kobewi 2022-07-25 09:51:18 +02:00 committed by Tomek
parent 72b5a4335e
commit 5315c9597f

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);
}