Browse Source

Fixes editor crash on closing

Fixes editor crash when the gizmo is destroyed and the `SceneTree` is already freed.

(cherry picked from commit 79f55fcded4f244cf632434f9c1f7cf7ccb0161a)
AndreaCatania 4 years ago
parent
commit
bd5663e2cf
1 changed files with 6 additions and 1 deletions
  1. 6 1
      editor/plugins/spatial_editor_plugin.cpp

+ 6 - 1
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) {
 void SpatialEditor::update_all_gizmos(Node *p_node) {
 	if (!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);
 	_update_all_gizmos(p_node);
 }
 }