Fix #12012: Crash when opening orders of another company. (#12013)

Orders window changes tooltip depending on vehicle type but did check if widget exists.
This commit is contained in:
Peter Nelson 2024-02-06 12:53:23 +00:00 committed by GitHub
parent e2d36f626b
commit e9ea837311
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -785,7 +785,9 @@ public:
this->CreateNestedTree();
this->vscroll = this->GetScrollbar(WID_O_SCROLLBAR);
this->GetWidget<NWidgetCore>(WID_O_DEPOT_ACTION)->tool_tip = STR_ORDER_TRAIN_DEPOT_ACTION_TOOLTIP + v->type;
if (NWidgetCore *nwid = this->GetWidget<NWidgetCore>(WID_O_DEPOT_ACTION); nwid != nullptr) {
nwid->tool_tip = STR_ORDER_TRAIN_DEPOT_ACTION_TOOLTIP + v->type;
}
this->FinishInitNested(v->index);
this->selected_order = -1;