diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2020-06-08 14:23:30 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-08 14:23:30 +0200 |
commit | 201d5a7fc53c041e011ad7a79b805f5989216d28 (patch) | |
tree | da054de8a14fcef73fe6e4dc4656cff950b6d4a9 /scene/resources | |
parent | d9f0477dad0aeb92d16da8d8bff37bece0f9fedd (diff) | |
parent | c080ec5da220474a80789afa33cc4f5612cddb50 (diff) |
Merge pull request #39389 from akien-mga/packedscene-root-aint-got-parents
PackedScene: Prevent crash when root node has `parent` attribute
Diffstat (limited to 'scene/resources')
-rw-r--r-- | scene/resources/packed_scene.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/scene/resources/packed_scene.cpp b/scene/resources/packed_scene.cpp index 058e89cf2e..cb201bc539 100644 --- a/scene/resources/packed_scene.cpp +++ b/scene/resources/packed_scene.cpp @@ -98,6 +98,9 @@ Node *SceneState::instance(GenEditState p_edit_state) const { } #endif parent = nparent; + } else { + // i == 0 is root node. Confirm that it doesn't have a parent defined. + ERR_FAIL_COND_V_MSG(n.parent != -1, nullptr, vformat("Invalid scene: root node %s cannot specify a parent node.", snames[n.name])); } Node *node = nullptr; |