1
0
Fork 0

Fix a startup issue Vic Mar reported

- accept invalid/missing airport IDs when starting ATC
This commit is contained in:
James Turner 2015-12-14 14:59:33 -06:00
parent 9c467af6bf
commit ff33aa038e

View file

@ -76,7 +76,8 @@ FGAirportDynamicsRef AirportDynamicsManager::dynamicsForICAO(const std::string &
FGAirportRef apt(FGAirport::findByIdent(icao)); FGAirportRef apt(FGAirport::findByIdent(icao));
if (!apt) if (!apt)
throw sg_exception("dynamicsForICAO: Invalid ICAO:" + icao); return FGAirportDynamicsRef();
FGAirportDynamicsRef d(new FGAirportDynamics(apt)); FGAirportDynamicsRef d(new FGAirportDynamics(apt));
XMLLoader::load(d.ptr()); XMLLoader::load(d.ptr());
@ -92,6 +93,9 @@ FGAirportDynamicsRef AirportDynamicsManager::dynamicsForICAO(const std::string &
FGAirportDynamicsRef AirportDynamicsManager::find(const std::string &icao) FGAirportDynamicsRef AirportDynamicsManager::find(const std::string &icao)
{ {
if (icao.empty())
return FGAirportDynamicsRef();
AirportDynamicsManager* instance = static_cast<AirportDynamicsManager*>(globals->get_subsystem("airport-dynamics")); AirportDynamicsManager* instance = static_cast<AirportDynamicsManager*>(globals->get_subsystem("airport-dynamics"));
if (!instance) if (!instance)
return FGAirportDynamicsRef(); return FGAirportDynamicsRef();