Browse Source

Fix accessing scene tree without checking: MeshInstance3D::create_debug_tangents, GIProbe::bake

(cherry picked from commit ef589a7cd3551a2e088a7293db0ca79845c1745f)
kleonc 4 năm trước cách đây
mục cha
commit
5445d04fbe
2 tập tin đã thay đổi với 2 bổ sung2 xóa
  1. 1 1
      scene/3d/gi_probe.cpp
  2. 1 1
      scene/3d/mesh_instance.cpp

+ 1 - 1
scene/3d/gi_probe.cpp

@@ -441,7 +441,7 @@ void GIProbe::bake(Node *p_from_node, bool p_create_visual_debug) {
 		mmi->set_multimesh(baker.create_debug_multimesh());
 		add_child(mmi);
 #ifdef TOOLS_ENABLED
-		if (get_tree()->get_edited_scene_root() == this) {
+		if (is_inside_tree() && get_tree()->get_edited_scene_root() == this) {
 			mmi->set_owner(this);
 		} else {
 			mmi->set_owner(get_owner());

+ 1 - 1
scene/3d/mesh_instance.cpp

@@ -782,7 +782,7 @@ void MeshInstance::create_debug_tangents() {
 		add_child(mi);
 #ifdef TOOLS_ENABLED
 
-		if (this == get_tree()->get_edited_scene_root())
+		if (is_inside_tree() && this == get_tree()->get_edited_scene_root())
 			mi->set_owner(this);
 		else
 			mi->set_owner(get_owner());