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:
@@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user