Bugfix: prevent crash when creating TRACKPOINT without location.

Introduced in 2f0449c420
This commit is contained in:
Dennis Guse
2021-06-14 12:11:23 +02:00
parent e9e48e4a79
commit 47a340578f
@@ -172,13 +172,14 @@ public class TrackStatisticsUpdater {
return;
}
if (!trackPoint.hasSensorDistance()) {
if (!trackPoint.hasSensorDistance()
&& trackPoint.hasLocation() && lastMovingTrackPoint.hasLocation()) {
// GPS-based distance/speed
Distance movingDistance = trackPoint.distanceToPrevious(lastMovingTrackPoint);
if (movingDistance.lessThan(minGPSDistance) && !trackPoint.isMoving()) {
if (movingDistance != null && movingDistance.lessThan(minGPSDistance) && !trackPoint.isMoving()) {
speedBuffer_mps.reset();
lastTrackPoint = trackPoint;
return;
return; //TOOD Why? Is there nothing to be done afterwards?
}
// Update total distance
currentSegment.addTotalDistance(movingDistance);