summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--scene/main/viewport.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp
index 86992c38f0..8545efb966 100644
--- a/scene/main/viewport.cpp
+++ b/scene/main/viewport.cpp
@@ -1900,7 +1900,13 @@ void Viewport::_gui_input_event(Ref<InputEvent> p_event) {
if (gui.drag_data.get_type() != Variant::NIL) {
gui.mouse_focus = NULL;
+ break;
} else {
+ if (gui.drag_preview != NULL) {
+ ERR_PRINT("Don't set a drag preview and return null data. Preview was deleted and drag request ignored.");
+ memdelete(gui.drag_preview);
+ gui.drag_preview = NULL;
+ }
gui.dragging = false;
}