1
0
mirror of https://github.com/OpenTTD/OpenTTD.git synced 2025-08-12 17:19:09 +00:00

Fix #11649: Allow disabling a widget that does not exist.

Orders window has different widget layouts dependening 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.
This commit is contained in:
2023-12-30 12:59:57 +00:00
parent 268e512fb8
commit 0b8b300417

View File

@@ -327,7 +327,8 @@ public:
*/
inline void SetWidgetDisabledState(WidgetID widget_index, bool disab_stat)
{
this->GetWidget<NWidgetCore>(widget_index)->SetDisabled(disab_stat);
NWidgetCore *nwid = this->GetWidget<NWidgetCore>(widget_index);
if (nwid != nullptr) nwid->SetDisabled(disab_stat);
}
/**