From de79bd4599107b22cdd97f24409ccf9ec929aef0 Mon Sep 17 00:00:00 2001 From: IntelOrca Date: Thu, 14 Apr 2016 17:41:06 +0100 Subject: [PATCH] fix #3294: crash when closing a window being dragged --- src/input.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/input.c b/src/input.c index e34c8f84ae..c5279f291f 100644 --- a/src/input.c +++ b/src/input.c @@ -535,7 +535,13 @@ static void input_viewport_drag_continue() dx = newDragX - gInputDragLastX; dy = newDragY - gInputDragLastY; w = window_find_by_number(_dragWidget.window_classification, _dragWidget.window_number); - assert(w != NULL); + + // #3294: Window can be closed during a drag session, so just finish + // the session if the window no longer exists + if (w == NULL) { + input_viewport_drag_end(); + return; + } viewport = w->viewport; _ticksSinceDragStart += RCT2_GLOBAL(RCT2_ADDRESS_TICKS_SINCE_LAST_UPDATE, sint16);