diff --git a/src/Airports/airport.cxx b/src/Airports/airport.cxx index 683d0af04..0e1fbc443 100644 --- a/src/Airports/airport.cxx +++ b/src/Airports/airport.cxx @@ -189,11 +189,14 @@ bool FGAirport::hasHelipadWithIdent(const std::string& aIdent) const //------------------------------------------------------------------------------ FGRunwayRef FGAirport::getRunwayByIdent(const std::string& aIdent) const { - loadRunways(); - for (auto rwy : mRunways) { - if (rwy->ident() == aIdent) { - return rwy; - } + if (aIdent.empty()) + return {}; + + loadRunways(); + for (auto rwy : mRunways) { + if (rwy->ident() == aIdent) { + return rwy; + } } SG_LOG(SG_GENERAL, SG_ALERT, "no such runway '" << aIdent << "' at airport " << ident()); diff --git a/src/Airports/dynamics.cxx b/src/Airports/dynamics.cxx index 577e4f27f..d67247a9d 100644 --- a/src/Airports/dynamics.cxx +++ b/src/Airports/dynamics.cxx @@ -796,10 +796,11 @@ bool FGAirportDynamics::innerGetActiveRunway(const string & trafficType, if (action == 2) // landing { - int nr = landing.size(); - if (nr) { + if (!landing.empty()) { runway = chooseRwyByHeading(landing, heading); - } else { //fallback + } + + if (runway.empty()) { //fallback runway = chooseRunwayFallback(); } }