forked from upstream-mirrors/OpenTracks
TrackDataHub: do not send more TrackPoints after stop().
This commit is contained in:
@@ -342,14 +342,16 @@ public class TrackDataHub {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TrackPoint trackPoint = null;
|
TrackPoint trackPoint = null;
|
||||||
TrackStatisticsUpdater currentUpdater = trackStatisticsUpdater; //TODO This prevents a NPE if stop() is happening while notifyTrackPointsTableUpdate()
|
|
||||||
if (currentUpdater == null) {
|
|
||||||
Log.e(TAG, "notifyTrackPointsTableUpdate() while being stopped.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
try (TrackPointIterator trackPointIterator = contentProviderUtils.getTrackPointLocationIterator(selectedTrackId, next)) {
|
try (TrackPointIterator trackPointIterator = contentProviderUtils.getTrackPointLocationIterator(selectedTrackId, next)) {
|
||||||
|
|
||||||
while (trackPointIterator.hasNext()) {
|
while (trackPointIterator.hasNext()) {
|
||||||
|
if (!isStarted()) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Prevents a NPE if stop() is happening while notifyTrackPointsTableUpdate()
|
||||||
|
TrackStatisticsUpdater currentUpdater = trackStatisticsUpdater;
|
||||||
|
|
||||||
trackPoint = trackPointIterator.next();
|
trackPoint = trackPointIterator.next();
|
||||||
TrackPoint.Id trackPointId = trackPoint.getId();
|
TrackPoint.Id trackPointId = trackPoint.getId();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user