# HG changeset patch # User Peter Nelson # Date 2023-12-30 13:29:31 # Node ID 6fb226bd4d6d4f8062b01e4b2d3fc2016c866405 # Parent ddc7bb191071fa385450f270d4d7b385fb0a750d Fix #11649: Ignore disabling a widget that does not exist. (#11652) Orders window has different widget layouts depending on vehicle type which don't all have the same widgets, and therefore it tries to disable widgets that might not exist. Restore the old behaviour of ignoring such requests, instead of crashing. diff --git a/src/window_gui.h b/src/window_gui.h --- a/src/window_gui.h +++ b/src/window_gui.h @@ -327,7 +327,8 @@ public: */ inline void SetWidgetDisabledState(WidgetID widget_index, bool disab_stat) { - this->GetWidget(widget_index)->SetDisabled(disab_stat); + NWidgetCore *nwid = this->GetWidget(widget_index); + if (nwid != nullptr) nwid->SetDisabled(disab_stat); } /**