]> git.mxchange.org Git - flightgear.git/commitdiff
marker beacon: catch NULL pointer
authorThorstenB <brehmt@gmail.com>
Mon, 26 Mar 2012 19:04:23 +0000 (21:04 +0200)
committerThorstenB <brehmt@gmail.com>
Mon, 26 Mar 2012 19:11:04 +0000 (21:11 +0200)
when runway not in navdb (affects incomplete/inconsistent nav data only).

src/Navaids/markerbeacon.cxx

index 6518799613505579ae2d84770b8366fc43567597..2192ae5148fd46369841bc78c1497f72e8e3bc84 100644 (file)
@@ -51,6 +51,11 @@ FGMarkerBeaconRecord::create(int aTy, const string& aName, const SGGeod& aPos)
 {
   Type fgpTy = mapType(aTy);
   FGRunway* runway = getRunwayFromName(aName);
+  if (!runway)
+  {
+      SG_LOG(SG_GENERAL, SG_ALERT, "Failed to create beacon for unknown runway '" << aName << "'.");
+      return NULL;
+  }
   SGGeod pos(aPos);
   // fudge elevation to the runway elevation if it's not specified
   if (fabs(pos.getElevationFt()) < 0.01) {