From 162182a8ee2b91af8efad9d04ed4b7e7985fdf01 Mon Sep 17 00:00:00 2001 From: Skalii Date: Wed, 10 Feb 2021 12:30:09 +0200 Subject: [PATCH] fix for future use when new track recording starts --- .../net/osmand/plus/track/GpxBlockStatisticsBuilder.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/track/GpxBlockStatisticsBuilder.java b/OsmAnd/src/net/osmand/plus/track/GpxBlockStatisticsBuilder.java index 2f11a6136a..7d7b911078 100644 --- a/OsmAnd/src/net/osmand/plus/track/GpxBlockStatisticsBuilder.java +++ b/OsmAnd/src/net/osmand/plus/track/GpxBlockStatisticsBuilder.java @@ -100,12 +100,15 @@ public class GpxBlockStatisticsBuilder { GPXFile gpxFile = getGPXFile(); GpxDisplayItem gpxDisplayItem = null; GPXTrackAnalysis analysis = null; + boolean withoutGaps = false; if (gpxFile.tracks.size() > 0) { gpxDisplayItem = getDisplayItem(gpxFile); - analysis = gpxDisplayItem.analysis; } - if (gpxDisplayItem != null && analysis != null) { - boolean withoutGaps = !selectedGpxFile.isJoinSegments() && gpxDisplayItem.isGeneralTrack(); + if (gpxDisplayItem != null) { + analysis = gpxDisplayItem.analysis; + withoutGaps = !selectedGpxFile.isJoinSegments() && gpxDisplayItem.isGeneralTrack(); + } + if (analysis != null) { float totalDistance = withoutGaps ? analysis.totalDistanceWithoutGaps : analysis.totalDistance; float timeSpan = withoutGaps ? analysis.timeSpanWithoutGaps : analysis.timeSpan; String asc = OsmAndFormatter.getFormattedAlt(analysis.diffElevationUp, app);