Skip to content

Commit

Permalink
Merge pull request #84870 from jsjtxietian/add-set-selected-protection
Browse files Browse the repository at this point in the history
Make Tree's `set_selected` check if the TreeItem belongs to the tree
  • Loading branch information
akien-mga committed Nov 14, 2023
2 parents 9c67a02 + b79cac6 commit c26b36e
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions scene/gui/tree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4544,6 +4544,8 @@ TreeItem *Tree::get_selected() const {
void Tree::set_selected(TreeItem *p_item, int p_column) {
ERR_FAIL_INDEX(p_column, columns.size());
ERR_FAIL_NULL(p_item);
ERR_FAIL_COND_MSG(p_item->get_tree() != this, "The provided TreeItem does not belong to this Tree. Ensure that the TreeItem is a part of the Tree before setting it as selected.");

select_single_item(p_item, get_root(), p_column);
}

Expand Down

0 comments on commit c26b36e

Please sign in to comment.