From ff33aa038ef7a968616fd608375e5c0448c89b28 Mon Sep 17 00:00:00 2001 From: James Turner Date: Mon, 14 Dec 2015 14:59:33 -0600 Subject: [PATCH] Fix a startup issue Vic Mar reported - accept invalid/missing airport IDs when starting ATC --- src/Airports/airportdynamicsmanager.cxx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Airports/airportdynamicsmanager.cxx b/src/Airports/airportdynamicsmanager.cxx index 99885fb2e..350041782 100644 --- a/src/Airports/airportdynamicsmanager.cxx +++ b/src/Airports/airportdynamicsmanager.cxx @@ -76,7 +76,8 @@ FGAirportDynamicsRef AirportDynamicsManager::dynamicsForICAO(const std::string & FGAirportRef apt(FGAirport::findByIdent(icao)); if (!apt) - throw sg_exception("dynamicsForICAO: Invalid ICAO:" + icao); + return FGAirportDynamicsRef(); + FGAirportDynamicsRef d(new FGAirportDynamics(apt)); XMLLoader::load(d.ptr()); @@ -92,6 +93,9 @@ FGAirportDynamicsRef AirportDynamicsManager::dynamicsForICAO(const std::string & FGAirportDynamicsRef AirportDynamicsManager::find(const std::string &icao) { + if (icao.empty()) + return FGAirportDynamicsRef(); + AirportDynamicsManager* instance = static_cast(globals->get_subsystem("airport-dynamics")); if (!instance) return FGAirportDynamicsRef(); -- 2.39.5