Browse Source

Merge pull request #26441 from QbieShay/fix_sigill_when_no_parent_escn

Engine does not crash anymore if a non root node in escn is missing a parent.
Rémi Verschelde 6 năm trước cách đây
mục cha
commit
03862d43ad
1 tập tin đã thay đổi với 2 bổ sung0 xóa
  1. 2 0
      scene/resources/packed_scene.cpp

+ 2 - 0
scene/resources/packed_scene.cpp

@@ -92,6 +92,8 @@ Node *SceneState::instance(GenEditState p_edit_state) const {
 
 		if (i > 0) {
 
+			ERR_EXPLAIN(vformat("Invalid scene: node %s does not specify its parent node.", snames[n.name]))
+			ERR_FAIL_COND_V(n.parent == -1, NULL)
 			NODE_FROM_ID(nparent, n.parent);
 #ifdef DEBUG_ENABLED
 			if (!nparent && (n.parent & FLAG_ID_IS_PATH)) {