Add ERR_FAIL_COND_MSG for reparenting to self
This commit is contained in:
parent
c394eaa45c
commit
80869063bd
1 changed files with 1 additions and 0 deletions
|
|
@ -1957,6 +1957,7 @@ void Node::reparent(Node *p_parent, bool p_keep_global_transform) {
|
|||
ERR_THREAD_GUARD
|
||||
ERR_FAIL_NULL(p_parent);
|
||||
ERR_FAIL_NULL_MSG(data.parent, "Node needs a parent to be reparented.");
|
||||
ERR_FAIL_COND_MSG(p_parent == this, vformat("Can't reparent '%s' to itself.", p_parent->get_name()));
|
||||
|
||||
if (p_parent == data.parent) {
|
||||
return;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue