From b8a5e2431cde79b75656d05fc82348d886dac409 Mon Sep 17 00:00:00 2001 From: Sjoerd de Bruin Date: Mon, 7 Sep 2026 22:51:20 +0200 Subject: [PATCH] Fix #26754: Guard stale hover widget index when switching window pages (#27086) --- distribution/changelog.txt | 1 + src/openrct2-ui/input/MouseInput.cpp | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/distribution/changelog.txt b/distribution/changelog.txt index 0de2cc3969..a562f27636 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -1,6 +1,7 @@ 0.5.6 (in development) ------------------------------------------------------------------------ - Fix: [#24457] Yellow is always rendered as third remap in Ride window. +- Fix: [#26754] Switching window tabs by touch could crash the game on some Linux builds. - Fix: [#27052] Unnamed rides in RCT2 base and Wacky Worlds scenarios have hardcoded English names. 0.5.5 (2026-09-06) diff --git a/src/openrct2-ui/input/MouseInput.cpp b/src/openrct2-ui/input/MouseInput.cpp index 626e3cb631..3cdb1d4d1e 100644 --- a/src/openrct2-ui/input/MouseInput.cpp +++ b/src/openrct2-ui/input/MouseInput.cpp @@ -1024,6 +1024,11 @@ namespace OpenRCT2 if (w != nullptr) { w->onPrepareDraw(); + + // Switching a window to another page can leave the remembered index out of range. + if (static_cast(gHoverWidget.widgetIndex) >= w->widgets.size()) + return; + if (w->widgets[gHoverWidget.widgetIndex].type == WidgetType::flatBtn || w->widgets[gHoverWidget.widgetIndex].type == WidgetType::hiddenButton) {