Skip to content

Commit 7702209

Browse files
committed
Merge pull request godotengine#102451 from ryevdokimov/add-fail-cond-msg-reparent-self
Add `ERR_FAIL_COND_MSG` for reparenting to self
2 parents 3c43508 + 8086906 commit 7702209

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
@@ -1954,6 +1954,7 @@ void Node::reparent(Node *p_parent, bool p_keep_global_transform) {
19541954
ERR_THREAD_GUARD
19551955
ERR_FAIL_NULL(p_parent);
19561956
ERR_FAIL_NULL_MSG(data.parent, "Node needs a parent to be reparented.");
1957+
ERR_FAIL_COND_MSG(p_parent == this, vformat("Can't reparent '%s' to itself.", p_parent->get_name()));
19571958

19581959
if (p_parent == data.parent) {
19591960
return;

0 commit comments

Comments
 (0)