Fix 77f27e08: Crash due to incorrect use of AirportSpec::GetIndex

This commit is contained in:
Jonathan G Rennison 2024-08-08 19:06:11 +01:00
parent e4bd353d12
commit 89d2cf3a16

View File

@ -539,11 +539,12 @@ public:
/* If that fails, select the first available airport
* from the first class where airports are available. */
for (const auto &cls : AirportClass::Classes()) {
for (const auto &as : cls.Specs()) {
for (uint i = 0; i < cls.GetSpecCount(); i++) {
const AirportSpec *as = cls.GetSpec(i);
if (as->IsAvailable()) {
_selected_airport_class = cls.Index();
this->vscroll->SetCount(cls.GetSpecCount());
this->SelectOtherAirport(as->GetIndex());
this->SelectOtherAirport(i);
return;
}
}