fix #3294: crash when closing a window being dragged

This commit is contained in:
IntelOrca 2016-04-14 17:41:06 +01:00
parent 2df58747e5
commit de79bd4599
1 changed files with 7 additions and 1 deletions

View File

@ -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);