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.
This commit is contained in:
Peter Nelson 2023-12-30 13:29:31 +00:00 committed by GitHub
parent 268e512fb8
commit f3b4d2a384
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

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);
}
/**