From d365689d5c1641369219bbc07ba74016a72cd266 Mon Sep 17 00:00:00 2001
From: ThorstenB <brehmt@gmail.com>
Date: Fri, 21 Jan 2011 23:44:23 +0100
Subject: [PATCH] Fix crash in GPS module. Fixes crash on exit (during property
 untie). Also potential run-time crash.

---
 src/Instrumentation/gps.cxx | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/Instrumentation/gps.cxx b/src/Instrumentation/gps.cxx
index 853d49d46..f0ecf6f04 100644
--- a/src/Instrumentation/gps.cxx
+++ b/src/Instrumentation/gps.cxx
@@ -1158,7 +1158,7 @@ double GPS::getWP1Bearing() const
 
 double GPS::getWP1MagBearing() const
 {
-  if (!_dataValid) {
+  if (!_dataValid || !_wayptController.get()) {
     return -9999.0;
   }