Bugfix: prevent NPE.

Fixes #374.
This commit is contained in:
Dennis Guse
2020-08-15 21:23:14 +02:00
parent 3ae30e2468
commit a87d2e5b09
@@ -333,9 +333,10 @@ public class StatisticsRecordingFragment extends Fragment implements TrackDataLi
lastTrackPoint = null; lastTrackPoint = null;
} }
if (lastTrackPoint != null) { TrackPoint trackPoint = lastTrackPoint; //NOTE: There seems to be a race condition; just fix the symptom for now.
boolean hasFix = !LocationUtils.isLocationOld(lastTrackPoint.getLocation()); if (trackPoint != null) {
boolean hasGoodFix = TrackPointUtils.fulfillsAccuracy(lastTrackPoint, recordingGpsAccuracy); boolean hasFix = !LocationUtils.isLocationOld(trackPoint.getLocation());
boolean hasGoodFix = TrackPointUtils.fulfillsAccuracy(trackPoint, recordingGpsAccuracy);
if (!hasFix || !hasGoodFix) { if (!hasFix || !hasGoodFix) {
lastTrackPoint = null; lastTrackPoint = null;