X-Git-Url: http://gitweb.fperrin.net/?p=GpsPrune.git;a=blobdiff_plain;f=tim%2Fprune%2Fdata%2FSelection.java;h=f09088dc218e6f498cef7d78a498a5995e019c02;hp=c375e820b4a05b022682deef2b675ee27a82b8d8;hb=d3679d647d57c2ee7376ddbf6def2d5b23c04307;hpb=312fec956e43f5d0a38617da5d0add9c62563e2c diff --git a/tim/prune/data/Selection.java b/tim/prune/data/Selection.java index c375e82..f09088d 100644 --- a/tim/prune/data/Selection.java +++ b/tim/prune/data/Selection.java @@ -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();