Skip to content

Commit

Permalink
Make Tree's set_selected check if treeitem belongs to the tree
Browse files Browse the repository at this point in the history
  • Loading branch information
jsjtxietian committed Nov 14, 2023
1 parent 6415006 commit b79cac6
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 b79cac6

Please sign in to comment.