From b13c4422e26ebd30b820758ccbe069562e3645eb Mon Sep 17 00:00:00 2001 From: "Nikolai V. Chr" Date: Fri, 15 Dec 2023 19:58:05 +0100 Subject: [PATCH] AP: Fix nil exception --- Nasal/autoflight.nas | 1 + 1 file changed, 1 insertion(+) diff --git a/Nasal/autoflight.nas b/Nasal/autoflight.nas index a208ad47..45334cc4 100644 --- a/Nasal/autoflight.nas +++ b/Nasal/autoflight.nas @@ -10,6 +10,7 @@ var apLoop = maketimer(1, func { var gnds_kt = getprop("/velocities/groundspeed-kt"); var max_wp = getprop("/autopilot/route-manager/route/num"); var current_course = getprop("/autopilot/route-manager/wp/true-bearing-deg"); + if (current_course == nil) current_course = getprop("orientation/true-heading-deg"); var wp_fly_to = getprop("/autopilot/route-manager/current-wp") + 1; if (wp_fly_to < 0) { wp_fly_to = 0;