From e9ea837311b0c6247bee384f8118c573ee59cfc5 Mon Sep 17 00:00:00 2001 From: Peter Nelson Date: Tue, 6 Feb 2024 12:53:23 +0000 Subject: [PATCH] Fix #12012: Crash when opening orders of another company. (#12013) Orders window changes tooltip depending on vehicle type but did check if widget exists. --- src/order_gui.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/order_gui.cpp b/src/order_gui.cpp index fc889d3fe0..c23472ed74 100644 --- a/src/order_gui.cpp +++ b/src/order_gui.cpp @@ -785,7 +785,9 @@ public: this->CreateNestedTree(); this->vscroll = this->GetScrollbar(WID_O_SCROLLBAR); - this->GetWidget(WID_O_DEPOT_ACTION)->tool_tip = STR_ORDER_TRAIN_DEPOT_ACTION_TOOLTIP + v->type; + if (NWidgetCore *nwid = this->GetWidget(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;