From 7ac17f5ae4576a11d1f16281b656ffcd463ab5ac Mon Sep 17 00:00:00 2001 From: peter1138 Date: Tue, 26 Feb 2019 06:45:14 +0000 Subject: [PATCH] Fix #7281: Unable to select last group in open livery window on group creation. --- src/company_gui.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/company_gui.cpp b/src/company_gui.cpp index 5a751a3635..143fa0ab82 100644 --- a/src/company_gui.cpp +++ b/src/company_gui.cpp @@ -1025,9 +1025,15 @@ public: if (data != -1) { /* data contains a VehicleType, rebuild list if it displayed */ if (this->livery_class == data + LC_GROUP_RAIL) { - if (!Group::IsValidID(this->sel)) this->sel = INVALID_GROUP; this->groups.ForceRebuild(); this->BuildGroupList((CompanyID)this->window_number); + this->SetRows(); + + if (!Group::IsValidID(this->sel)) { + this->sel = INVALID_GROUP; + if (this->groups.Length() > 0) this->sel = this->groups[0]->index; + } + this->SetDirty(); } return;