forked from upstream-mirrors/OpenTracks
Import: empty tracks cannot be imported as TrackStatistics cannot be restored.
#316.
This commit is contained in:
@@ -257,6 +257,9 @@ abstract class AbstractFileTrackImporter extends DefaultHandler implements Track
|
||||
for (TrackPoint trackPoint : trackData.bufferedTrackPoints) {
|
||||
statistics.addTrackPoint(trackPoint, recordingDistanceInterval);
|
||||
}
|
||||
if (!statistics.isTrackInitialized()) {
|
||||
throw new ImportParserException("Track did not contain any locations.");
|
||||
}
|
||||
trackData.track.setTrackStatistics(statistics.getTrackStatistics());
|
||||
|
||||
Track track = contentProviderUtils.getTrack(trackData.track.getUuid());
|
||||
|
||||
@@ -97,6 +97,10 @@ public class TrackStatisticsUpdater {
|
||||
return stats;
|
||||
}
|
||||
|
||||
public boolean isTrackInitialized() {
|
||||
return trackInitialized;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a trackPoint.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user