From bd5663e2cfeafd49973eb3c9e374484d65095479 Mon Sep 17 00:00:00 2001 From: AndreaCatania Date: Wed, 31 Mar 2021 11:53:32 +0200 Subject: [PATCH] Fixes editor crash on closing Fixes editor crash when the gizmo is destroyed and the `SceneTree` is already freed. (cherry picked from commit 79f55fcded4f244cf632434f9c1f7cf7ccb0161a) --- editor/plugins/spatial_editor_plugin.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/editor/plugins/spatial_editor_plugin.cpp b/editor/plugins/spatial_editor_plugin.cpp index 97ab8caefa8..ab5f327172d 100644 --- a/editor/plugins/spatial_editor_plugin.cpp +++ b/editor/plugins/spatial_editor_plugin.cpp @@ -4470,7 +4470,12 @@ void _update_all_gizmos(Node *p_node) { void SpatialEditor::update_all_gizmos(Node *p_node) { if (!p_node) { - p_node = SceneTree::get_singleton()->get_root(); + if (SceneTree::get_singleton()) { + p_node = SceneTree::get_singleton()->get_root(); + } else { + // No scene tree, so nothing to update. + return; + } } _update_all_gizmos(p_node); }