From 7eccdbe6933020dd9dea1a8b236df1032ec086f3 Mon Sep 17 00:00:00 2001 From: kleonc <9283098+kleonc@users.noreply.github.com> Date: Sun, 16 May 2021 14:01:01 +0200 Subject: [PATCH] Fix accessing scene tree without checking: MeshInstance3D::create_debug_tangents, GIProbe::bake (cherry picked from commit ef589a7cd3551a2e088a7293db0ca79845c1745f) --- scene/3d/gi_probe.cpp | 2 +- scene/3d/mesh_instance.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scene/3d/gi_probe.cpp b/scene/3d/gi_probe.cpp index b93017c0a4b..f0d9b5c0994 100644 --- a/scene/3d/gi_probe.cpp +++ b/scene/3d/gi_probe.cpp @@ -391,7 +391,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()); diff --git a/scene/3d/mesh_instance.cpp b/scene/3d/mesh_instance.cpp index 51c4b662e72..d585ec557b9 100644 --- a/scene/3d/mesh_instance.cpp +++ b/scene/3d/mesh_instance.cpp @@ -812,7 +812,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());