forked from upstream-mirrors/OpenTracks
TrackRecordingManager: rather crash than try to load invalid data.
This commit is contained in:
@@ -131,6 +131,10 @@ public class TrackRecordingManager implements SharedPreferences.OnSharedPreferen
|
|||||||
}
|
}
|
||||||
|
|
||||||
RecordingData getDataForUI() {
|
RecordingData getDataForUI() {
|
||||||
|
if (trackId == null) {
|
||||||
|
throw new RuntimeException("Requesting data if not recording should not be done.");
|
||||||
|
}
|
||||||
|
|
||||||
Pair<TrackPoint, SensorDataSet> current = trackPointCreator.createCurrentTrackPoint(lastTrackPointUIWithSpeed, lastTrackPointUIWithAltitude, lastStoredTrackPointWithLocation);
|
Pair<TrackPoint, SensorDataSet> current = trackPointCreator.createCurrentTrackPoint(lastTrackPointUIWithSpeed, lastTrackPointUIWithAltitude, lastStoredTrackPointWithLocation);
|
||||||
TrackPoint trackPoint = current.first;
|
TrackPoint trackPoint = current.first;
|
||||||
TrackStatisticsUpdater tmpTrackStatisticsUpdater = new TrackStatisticsUpdater(trackStatisticsUpdater, trackPoint);
|
TrackStatisticsUpdater tmpTrackStatisticsUpdater = new TrackStatisticsUpdater(trackStatisticsUpdater, trackPoint);
|
||||||
@@ -139,8 +143,7 @@ public class TrackRecordingManager implements SharedPreferences.OnSharedPreferen
|
|||||||
|
|
||||||
Track track = contentProviderUtils.getTrack(trackId); //Get copy TODO: Avoid re-loading data from DB
|
Track track = contentProviderUtils.getTrack(trackId); //Get copy TODO: Avoid re-loading data from DB
|
||||||
if (track == null) {
|
if (track == null) {
|
||||||
Log.w(TAG, "Requesting data if not recording is taking place, should not be done.");
|
throw new RuntimeException("Data could not be loaded for TrackId " + trackId);
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TrackBuilder trackBuilder = new TrackBuilder(track);
|
TrackBuilder trackBuilder = new TrackBuilder(track);
|
||||||
|
|||||||
Reference in New Issue
Block a user