[4.2] Fix crash when previewing a scene with a mesh as the root node

This commit is contained in:
Aaron Franke 2024-01-31 06:38:25 -06:00
parent c7fb0645af
commit 424a6a6bf5
No known key found for this signature in database
GPG Key ID: 40A1750B977E56BF
1 changed files with 4 additions and 1 deletions

View File

@ -311,7 +311,10 @@ void SceneImportSettings::_fill_scene(Node *p_node, TreeItem *p_parent_item) {
Ref<ImporterMesh> editor_mesh = src_mesh_node->get_mesh();
mesh_node->set_mesh(editor_mesh->get_mesh());
}
// Replace the original mesh node in the scene tree with the new one.
if (unlikely(p_node == scene)) {
scene = mesh_node;
}
p_node->replace_by(mesh_node);
memdelete(p_node);
p_node = mesh_node;