From cc84f3604b309d8ad7aaf939a9f7f79f1f52cebe Mon Sep 17 00:00:00 2001 From: Charles Pigott Date: Wed, 31 Dec 2025 22:24:31 +0000 Subject: [PATCH] Fix #15004: Crash when dropdown is open when end game screen appears (#15006) --- src/window.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/window.cpp b/src/window.cpp index 05f03dc7d8..2cc8670eb2 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -296,7 +296,9 @@ void Window::OnDropdownClose(Point pt, WidgetID widget, int index, int click_res { if (widget < 0) return; - if (instant_close) { + /* Many dropdown selections depend on the position of the main toolbar, + * so if it doesn't exist (e.g. the end screen has appeared), just skip the instant close behaviour. */ + if (instant_close && FindWindowById(WC_MAIN_TOOLBAR, 0) != nullptr) { /* Send event for selected option if we're still * on the parent button of the dropdown (behaviour of the dropdowns in the main toolbar). */ if (GetWidgetFromPos(this, pt.x, pt.y) == widget) {