diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2021-09-21 14:23:54 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-21 14:23:54 +0200 |
commit | dc2b06260901249f1510eaafe11d7db91ed5a579 (patch) | |
tree | f4638331ab3d7762bbab63b3f9b6c9aacae97df5 /scene/resources | |
parent | 82c12060b26d0045a5c7d9b3a1f94b29baf062ea (diff) | |
parent | f400c9239e6283d1297f47642b63fb81cd2e07ed (diff) |
Merge pull request #52775 from gyroninja/fix-instantiated-root-node-crash
Fail at instantiating a packed scene if the root node is instantiated
Diffstat (limited to 'scene/resources')
-rw-r--r-- | scene/resources/packed_scene.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/scene/resources/packed_scene.cpp b/scene/resources/packed_scene.cpp index e74f759855..59faa50114 100644 --- a/scene/resources/packed_scene.cpp +++ b/scene/resources/packed_scene.cpp @@ -99,8 +99,9 @@ Node *SceneState::instantiate(GenEditState p_edit_state) const { #endif parent = nparent; } else { - // i == 0 is root node. Confirm that it doesn't have a parent defined. + // i == 0 is root node. ERR_FAIL_COND_V_MSG(n.parent != -1, nullptr, vformat("Invalid scene: root node %s cannot specify a parent node.", snames[n.name])); + ERR_FAIL_COND_V_MSG(n.type == TYPE_INSTANCED && base_scene_idx < 0, nullptr, vformat("Invalid scene: root node %s in an instance, but there's no base scene.", snames[n.name])); } Node *node = nullptr; |