]> git.mxchange.org Git - flightgear.git/commitdiff
Potential fix for bug #471 (crash in checkspeedadjustment).
authorDurk Talsma <durktals@gmail.com>
Sat, 22 Oct 2011 15:57:37 +0000 (17:57 +0200)
committerDurk Talsma <durktals@gmail.com>
Sat, 22 Oct 2011 15:57:37 +0000 (17:57 +0200)
src/Airports/groundnetwork.cxx

index a3a3245fe9af7d711be60af249d1cd22abc483d7..fc943fb15a6a39ef36550201bac591c50a563803 100644 (file)
@@ -853,6 +853,7 @@ void FGGroundNetwork::checkSpeedAdjustment(int id, double lat,
         SGGeod curr(SGGeod::fromDegM(lon, lat, alt));
         //TrafficVector iterator closest;
         closest = current;
+        closestOnNetwork = current;
         for (TrafficVectorIterator i = activeTraffic.begin();
                 i != activeTraffic.end(); i++) {
             if (i == current) {
@@ -953,7 +954,7 @@ void FGGroundNetwork::checkSpeedAdjustment(int id, double lat,
                 }
             }
         }
-        if ((closest == closestOnNetwork) && (current->getPriority() < closest->getPriority()) && needBraking) {
+        if ((closest->getId() == closestOnNetwork->getId()) && (current->getPriority() < closest->getPriority()) && needBraking) {
             swap(current, closest);
         }
     }