]> git.mxchange.org Git - flightgear.git/commitdiff
Check one potential source of the prime-meridian crash.
authorjmt <jmt>
Mon, 2 Nov 2009 23:33:07 +0000 (23:33 +0000)
committerTim Moore <timoore@redhat.com>
Wed, 4 Nov 2009 22:12:59 +0000 (23:12 +0100)
src/Navaids/positioned.cxx

index 2651199ce0bb77bb7077e18f6b72a5bd0f287b18..c4bce783ce29ab3e55399ad99086e25a17b12c3d 100644 (file)
@@ -35,6 +35,7 @@
 #include <simgear/math/sg_geodesy.hxx>
 #include <simgear/timing/timestamp.hxx>
 #include <simgear/debug/logstream.hxx>
+#include <simgear/structure/exception.hxx>
 
 #include "positioned.hxx"
 
@@ -240,6 +241,10 @@ public:
   
   bool operator()(const FGPositionedRef& a, const FGPositionedRef& b) const
   {
+    if (!a || !b) {
+      throw sg_exception("empty reference passed to DistanceOrdering");
+    }
+  
     double dA = distSqr(a->cart(), mPos),
       dB = distSqr(b->cart(), mPos);
     return dA < dB;