]> gitweb.fperrin.net Git - GpsPrune.git/blobdiff - tim/prune/data/Selection.java
Version 2, March 2007
[GpsPrune.git] / tim / prune / data / Selection.java
index c375e820b4a05b022682deef2b675ee27a82b8d8..f09088dc218e6f498cef7d78a498a5995e019c02 100644 (file)
@@ -383,20 +383,28 @@ public class Selection
         */
        private void check()
        {
-               if (_track != null && _track.getNumPoints() > 0)
+               if (_track != null)
                {
-                       int maxIndex = _track.getNumPoints() - 1;
-                       if (_currentPoint > maxIndex)
+                       if (_track.getNumPoints() > 0)
                        {
-                               _currentPoint = maxIndex;
-                       }
-                       if (_endIndex > maxIndex)
-                       {
-                               _endIndex = maxIndex;
+                               int maxIndex = _track.getNumPoints() - 1;
+                               if (_currentPoint > maxIndex)
+                               {
+                                       _currentPoint = maxIndex;
+                               }
+                               if (_endIndex > maxIndex)
+                               {
+                                       _endIndex = maxIndex;
+                               }
+                               if (_startIndex > maxIndex)
+                               {
+                                       _startIndex = maxIndex;
+                               }
                        }
-                       if (_startIndex > maxIndex)
+                       else
                        {
-                               _startIndex = maxIndex;
+                               // track is empty, clear selections
+                               _currentPoint = _startIndex = _endIndex = -1;
                        }
                }
                _broker.informSubscribers();