From 6eb431d12c795e7c4a311e756cff58a318fe669b Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Mon, 22 Apr 2024 23:17:56 +0200 Subject: [PATCH] Fix rare error on drag&drop in Editor --- Source/Editor/CustomEditors/Dedicated/ScriptsEditor.cs | 5 ++--- Source/Editor/CustomEditors/Editors/CollectionEditor.cs | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/Source/Editor/CustomEditors/Dedicated/ScriptsEditor.cs b/Source/Editor/CustomEditors/Dedicated/ScriptsEditor.cs index fe068e4de..9227dac06 100644 --- a/Source/Editor/CustomEditors/Dedicated/ScriptsEditor.cs +++ b/Source/Editor/CustomEditors/Dedicated/ScriptsEditor.cs @@ -209,16 +209,15 @@ namespace FlaxEditor.CustomEditors.Dedicated public override DragDropEffect OnDragMove(ref Float2 location, DragData data) { var result = base.OnDragMove(ref location, data); - if (result != DragDropEffect.None) + if (result != DragDropEffect.None || _dragHandlers == null) return result; - return _dragHandlers.Effect; } /// public override void OnDragLeave() { - _dragHandlers.OnDragLeave(); + _dragHandlers?.OnDragLeave(); base.OnDragLeave(); } diff --git a/Source/Editor/CustomEditors/Editors/CollectionEditor.cs b/Source/Editor/CustomEditors/Editors/CollectionEditor.cs index 41715d654..d7d16083e 100644 --- a/Source/Editor/CustomEditors/Editors/CollectionEditor.cs +++ b/Source/Editor/CustomEditors/Editors/CollectionEditor.cs @@ -585,7 +585,7 @@ namespace FlaxEditor.CustomEditors.Editors public override DragDropEffect OnDragMove(ref Float2 location, DragData data) { var result = base.OnDragMove(ref location, data); - if (result != DragDropEffect.None) + if (result != DragDropEffect.None || _dragHandlers == null) return result; return _dragHandlers.Effect; @@ -594,7 +594,7 @@ namespace FlaxEditor.CustomEditors.Editors /// public override void OnDragLeave() { - _dragHandlers.OnDragLeave(); + _dragHandlers?.OnDragLeave(); base.OnDragLeave(); }