diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2022-08-28 21:21:53 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-28 21:21:53 +0200 |
commit | 011dbda2ea367a006469bbadd71c29d290bbce24 (patch) | |
tree | 67d98bf9f4fffbc1f692235768da801901efb1fc /scene/resources/packed_scene.cpp | |
parent | 82663e7eb01decc694a249ffdbd27fad8a67d027 (diff) | |
parent | a33903d23fb65bc84dd19487d0552f2a4670f803 (diff) |
Merge pull request #64999 from Chaosus/fix_packed_scene_crash
Diffstat (limited to 'scene/resources/packed_scene.cpp')
-rw-r--r-- | scene/resources/packed_scene.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/scene/resources/packed_scene.cpp b/scene/resources/packed_scene.cpp index 71bfb01de3..33334801c3 100644 --- a/scene/resources/packed_scene.cpp +++ b/scene/resources/packed_scene.cpp @@ -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]; |