Browse Source

Fail at instantiating if the root node is instantiated

(cherry picked from commit f400c9239e6283d1297f47642b63fb81cd2e07ed)
gyroninja 4 years ago
parent
commit
9f0d7b70fd
1 changed files with 2 additions and 1 deletions
  1. 2 1
      scene/resources/packed_scene.cpp

+ 2 - 1
scene/resources/packed_scene.cpp

@@ -99,8 +99,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.
+			// 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;