TrackDataHub: do not send more TrackPoints after stop().

This commit is contained in:
Dennis Guse
2021-05-24 16:56:20 +02:00
parent 7929d219ac
commit ccfcd3b306
@@ -342,14 +342,16 @@ public class TrackDataHub {
}
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)) {
while (trackPointIterator.hasNext()) {
if (!isStarted()) {
break;
}
//Prevents a NPE if stop() is happening while notifyTrackPointsTableUpdate()
TrackStatisticsUpdater currentUpdater = trackStatisticsUpdater;
trackPoint = trackPointIterator.next();
TrackPoint.Id trackPointId = trackPoint.getId();