1
0
Fork 0

Route-manager: guard against a procedure failure

When we have a STAR which is invalid for the selected runway, which
can occur when switching runway/approach, don’t cause a Nasal runtime
error.
This commit is contained in:
James Turner 2019-06-24 16:41:45 +01:00
parent 52373760e2
commit 20bcc16032

View file

@ -42,7 +42,6 @@ var RouteManagerDelegate = {
arrivalChanged: func
{
printlog('info', 'saw arrival changed');
me.flightplan.clearWPType('star');
me.flightplan.clearWPType('approach');
if (me.flightplan.destination == nil)
@ -60,9 +59,10 @@ var RouteManagerDelegate = {
if (me.flightplan.star != nil) {
printlog('info', 'routing via STAR ' ~ me.flightplan.star.id);
var wps = me.flightplan.star.route(me.flightplan.destination_runway);
me.flightplan.insertWaypoints(wps, -1);
initialApproachFix = wps[-1]; # final waypoint of STAR
if (wps != nil) {
me.flightplan.insertWaypoints(wps, -1);
initialApproachFix = wps[-1]; # final waypoint of STAR
}
}
if (me.flightplan.approach != nil) {