From df1b6a933bc0208e4b62d6ee44359a15fa2354fe Mon Sep 17 00:00:00 2001 From: Peter Nelson Date: Fri, 7 Jun 2024 21:57:18 +0100 Subject: [PATCH] Fix #12764: Crash when opening Detailed performance rating window with no companies. (#12765) --- src/graph_gui.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/graph_gui.cpp b/src/graph_gui.cpp index 10d7e1c495..e705e3749a 100644 --- a/src/graph_gui.cpp +++ b/src/graph_gui.cpp @@ -1402,7 +1402,9 @@ struct PerformanceRatingDetailWindow : Window { } /* Make sure the widget is lowered */ - this->LowerWidget(WID_PRD_COMPANY_FIRST + this->company); + if (this->company != INVALID_COMPANY) { + this->LowerWidget(WID_PRD_COMPANY_FIRST + this->company); + } } };