Node3DEditorViewport: Prevent crash while handling input

The selection might change before the user releases the mouse pointer,
and this would crash the editor.

This follows the same check that is done in ::_update_gizmos
This commit is contained in:
Miguel de Icaza
2025-12-11 10:09:00 -05:00
committed by Rémi Verschelde
parent 8dcf5b4eaf
commit eba4ceb0ea
+4 -2
View File
@@ -2204,8 +2204,10 @@ void Node3DEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
if (_edit.original_mouse_pos != _edit.mouse_pos || _edit.gizmo->get_plugin()->can_commit_handle_on_click()) {
_edit.gizmo->commit_handle(_edit.gizmo_handle, _edit.gizmo_handle_secondary, _edit.gizmo_initial_value, false);
}
spatial_editor->get_single_selected_node()->update_gizmos();
Node3D *selected_node = spatial_editor->get_single_selected_node();
if (selected_node) {
selected_node->update_gizmos();
}
_edit.gizmo = Ref<EditorNode3DGizmo>();
break;
}