summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2021-05-16 22:32:04 +0200
committerGitHub <noreply@github.com>2021-05-16 22:32:04 +0200
commitd4fc125fbc7d2a15ebb7ff2b472a64d9a71de023 (patch)
tree1005307aff006f77a65cad3b52107e75cb820633
parenta7421612d007b762e3a41e28df3d1f357d2fc4c6 (diff)
parentef589a7cd3551a2e088a7293db0ca79845c1745f (diff)
Merge pull request #48761 from kleonc/editor-get_tree-crash-fix
Fix accessing scene tree without checking: MeshInstance3D::create_debug_tangents, GIProbe::bake
-rw-r--r--scene/3d/gi_probe.cpp2
-rw-r--r--scene/3d/mesh_instance_3d.cpp2
2 files changed, 2 insertions, 2 deletions
diff --git a/scene/3d/gi_probe.cpp b/scene/3d/gi_probe.cpp
index 4d7fc29f15..6505fb1ee8 100644
--- a/scene/3d/gi_probe.cpp
+++ b/scene/3d/gi_probe.cpp
@@ -454,7 +454,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_3d.cpp b/scene/3d/mesh_instance_3d.cpp
index 27d5487a1a..c495f68890 100644
--- a/scene/3d/mesh_instance_3d.cpp
+++ b/scene/3d/mesh_instance_3d.cpp
@@ -427,7 +427,7 @@ void MeshInstance3D::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());