Prevent crash at loading some scenes

This commit is contained in:
Yuri Rubinsky 2022-08-28 21:56:04 +03:00
parent 006915b482
commit a33903d23f

View file

@ -288,9 +288,11 @@ Node *SceneState::instantiate(GenEditState p_edit_state) const {
// then tell this node to reference that resource.
if (n.instance >= 0) {
Ref<Resource> node_res = node->get(snames[nprops[j].name]);
node_res->copy_from(res);
node_res->configure_for_local_scene(node, resources_local_to_scene);
value = node_res;
if (node_res.is_valid()) {
node_res->copy_from(res);
node_res->configure_for_local_scene(node, resources_local_to_scene);
value = node_res;
}
} else {
HashMap<Ref<Resource>, Ref<Resource>>::Iterator E = resources_local_to_scene.find(res);
Node *base = i == 0 ? node : ret_nodes[0];