summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
Diffstat (limited to 'scene')
-rw-r--r--scene/resources/packed_scene.cpp3
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;