1
0
mirror of https://github.com/godotengine/godot.git synced 2026-01-06 19:41:11 +00:00

Add ERR_FAIL_COND_MSG for reparenting to self

This commit is contained in:
Robert Yevdokimov
2025-02-05 15:15:38 +04:00
parent c394eaa45c
commit 80869063bd

View File

@@ -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;