diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2023-07-08 18:20:14 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2023-07-08 18:20:14 +0200 |
commit | 0df423756ec09ec4803353f9223f3853d447f21b (patch) | |
tree | 3f9d1cf2be79502cc08702b9aff8bbe65578d294 | |
parent | 46cd84b36212d5932c6cddfc6ed5f50ff60030bc (diff) | |
parent | b02dff6e1c6df8c3dd2fda518e4d5e3a4df28b15 (diff) | |
download | redot-engine-0df423756ec09ec4803353f9223f3853d447f21b.tar.gz |
Merge pull request #78847 from Sauermann/fix-sibling-fail
Fix `Node::add_sibling` parent check
-rw-r--r-- | scene/main/node.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/scene/main/node.cpp b/scene/main/node.cpp index 9ebd8f00a8..3715c06a33 100644 --- a/scene/main/node.cpp +++ b/scene/main/node.cpp @@ -1403,9 +1403,9 @@ void Node::add_child(Node *p_child, bool p_force_readable_name, InternalMode p_i void Node::add_sibling(Node *p_sibling, bool p_force_readable_name) { ERR_FAIL_COND_MSG(data.inside_tree && !Thread::is_main_thread(), "Adding a sibling to a node inside the SceneTree is only allowed from the main thread. Use call_deferred(\"add_sibling\",node)."); ERR_FAIL_NULL(p_sibling); - ERR_FAIL_NULL(data.parent); ERR_FAIL_COND_MSG(p_sibling == this, vformat("Can't add sibling '%s' to itself.", p_sibling->get_name())); // adding to itself! - ERR_FAIL_COND_MSG(data.blocked > 0, "Parent node is busy setting up children, `add_sibling()` failed. Consider using `add_sibling.call_deferred(sibling)` instead."); + ERR_FAIL_NULL(data.parent); + ERR_FAIL_COND_MSG(data.parent->data.blocked > 0, "Parent node is busy setting up children, `add_sibling()` failed. Consider using `add_sibling.call_deferred(sibling)` instead."); data.parent->add_child(p_sibling, p_force_readable_name, data.internal_mode); data.parent->_update_children_cache(); |