Skip to content

Commit

Permalink
Merge pull request #91677 from KoBeWi/duplication_went_wrong
Browse files Browse the repository at this point in the history
Fix crash when adding a child while duplicating a node
  • Loading branch information
akien-mga authored May 7, 2024
2 parents ec78dde + 5c0f796 commit 24ce827
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions scene/main/node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2930,8 +2930,10 @@ void Node::_duplicate_properties_node(const Node *p_root, const Node *p_original
}
}

for (int i = 0; i < p_copy->get_child_count(); i++) {
_duplicate_properties_node(p_root, p_original->get_child(i), p_copy->get_child(i));
for (int i = 0; i < p_original->get_child_count(); i++) {
Node *copy_child = p_copy->get_child(i);
ERR_FAIL_NULL_MSG(copy_child, "Child node disappeared while duplicating.");
_duplicate_properties_node(p_root, p_original->get_child(i), copy_child);
}
}

Expand Down

0 comments on commit 24ce827

Please sign in to comment.