Skip to content

Commit 8086906

Browse files
committed
Add ERR_FAIL_COND_MSG for reparenting to self
1 parent c394eaa commit 8086906

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

scene/main/node.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1957,6 +1957,7 @@ void Node::reparent(Node *p_parent, bool p_keep_global_transform) {
19571957
ERR_THREAD_GUARD
19581958
ERR_FAIL_NULL(p_parent);
19591959
ERR_FAIL_NULL_MSG(data.parent, "Node needs a parent to be reparented.");
1960+
ERR_FAIL_COND_MSG(p_parent == this, vformat("Can't reparent '%s' to itself.", p_parent->get_name()));
19601961

19611962
if (p_parent == data.parent) {
19621963
return;

0 commit comments

Comments
 (0)