From d7d19649aa74c9a7b808dac969f03cd0a5e6d7f0 Mon Sep 17 00:00:00 2001
From: James Turner <zakalawe@mac.com>
Date: Fri, 21 Sep 2012 12:47:51 +0100
Subject: [PATCH] Fix a stupid logic bug when re-ordering waypoints.

http://code.google.com/p/flightgear-bugs/issues/detail?id=870
---
 src/GUI/WaypointList.cxx | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/GUI/WaypointList.cxx b/src/GUI/WaypointList.cxx
index e8e5b36dc..967b3496c 100644
--- a/src/GUI/WaypointList.cxx
+++ b/src/GUI/WaypointList.cxx
@@ -90,11 +90,10 @@ public:
       --destIndex;
     }
     
-    unsigned int currentWpIndex = currentWaypoint();
-    WayptRef w(waypointAt(currentWpIndex));
-    _fp->deleteIndex(currentWpIndex);
+     int currentWpIndex = currentWaypoint();
     
-    SG_LOG(SG_GENERAL, SG_INFO, "wpt:" << w->ident());
+    WayptRef w = _fp->legAtIndex(srcIndex)->waypoint();
+    _fp->deleteIndex(srcIndex);
     _fp->insertWayptAtIndex(w, destIndex);
 
     if (srcIndex == currentWpIndex) {