From 222832f1d477c323f3d869dd92e097717f694b8d Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Fri, 23 Feb 2024 20:02:59 +0000 Subject: [PATCH] Fix #12166: Crash when opening tram road stop build window (#12168) --- src/road_gui.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/road_gui.cpp b/src/road_gui.cpp index c242c397bb..d8cf2bf004 100644 --- a/src/road_gui.cpp +++ b/src/road_gui.cpp @@ -1132,9 +1132,11 @@ private: const RoadStopSpec *spec = RoadStopClass::Get(_roadstop_gui_settings.roadstop_class)->GetSpec(_roadstop_gui_settings.roadstop_type); /* Raise and lower to ensure the correct widget is lowered after changing displayed orientation plane. */ - this->RaiseWidget(WID_BROS_STATION_NE + _roadstop_gui_settings.orientation); - this->GetWidget(WID_BROS_AVAILABLE_ORIENTATIONS)->SetDisplayedPlane((spec != nullptr && HasBit(spec->flags, RSF_DRIVE_THROUGH_ONLY)) ? 1 : 0); - this->LowerWidget(WID_BROS_STATION_NE + _roadstop_gui_settings.orientation); + if (RoadTypeIsRoad(_cur_roadtype)) { + this->RaiseWidget(WID_BROS_STATION_NE + _roadstop_gui_settings.orientation); + this->GetWidget(WID_BROS_AVAILABLE_ORIENTATIONS)->SetDisplayedPlane((spec != nullptr && HasBit(spec->flags, RSF_DRIVE_THROUGH_ONLY)) ? 1 : 0); + this->LowerWidget(WID_BROS_STATION_NE + _roadstop_gui_settings.orientation); + } if (_roadstop_gui_settings.orientation >= DIAGDIR_END) return;