From 171a9296e1feb6f31366d45cdcdcc33522d0403f Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Sun, 14 Feb 2021 16:50:50 +0000 Subject: [PATCH] Simbrief parser: handle no alternate --- Nasal/FMGC/SimbriefParser.nas | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Nasal/FMGC/SimbriefParser.nas b/Nasal/FMGC/SimbriefParser.nas index 087c1f44..9c4b7d21 100644 --- a/Nasal/FMGC/SimbriefParser.nas +++ b/Nasal/FMGC/SimbriefParser.nas @@ -134,12 +134,14 @@ var SimbriefParser = { fmgc.flightPlanController.flightplans[3].destination_runway = runwayStore; } - var alternateID = me.OFP.getNode("alternate/icao_code").getValue(); - var alternates = findAirportsByICAO(alternateID); - if (alternates != nil and size(alternates) != 0) { - fmgc.FMGCInternal.altAirport = alternateID; - atsu.ATISInstances[2].newStation(alternateID); - fmgc.FMGCInternal.altAirportSet = 1; + var alternateID = me.OFP.getNode("alternate/icao_code") == nil ? nil : me.OFP.getNode("alternate/icao_code").getValue(); + if (alternateID != nil) { + var alternates = findAirportsByICAO(alternateID); + if (size(alternates) != 0) { + fmgc.FMGCInternal.altAirport = alternateID; + atsu.ATISInstances[2].newStation(alternateID); + fmgc.FMGCInternal.altAirportSet = 1; + } } var wps = [];