From 318ffc541f4549ba5c61055b0c34892e0e0aeb47 Mon Sep 17 00:00:00 2001 From: Vitaliy Date: Tue, 25 Feb 2020 12:07:01 +0200 Subject: [PATCH] Add check for general track (cherry picked from commit 10c4e06aa1f167b12f397a6714fe09bcbdd86b04) --- OsmAnd/src/net/osmand/plus/GpxSelectionHelper.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/GpxSelectionHelper.java b/OsmAnd/src/net/osmand/plus/GpxSelectionHelper.java index bdea697a31..41d62c6c49 100644 --- a/OsmAnd/src/net/osmand/plus/GpxSelectionHelper.java +++ b/OsmAnd/src/net/osmand/plus/GpxSelectionHelper.java @@ -35,6 +35,7 @@ import org.json.JSONObject; import java.io.File; import java.util.ArrayList; import java.util.Collection; +import java.util.Collections; import java.util.List; import java.util.Map; import java.util.Map.Entry; @@ -599,6 +600,9 @@ public class GpxSelectionHelper { if (dataItem.getColor() != 0) { gpx.setColor(dataItem.getColor()); } + if (gpx.getGeneralTrack() == null) { + app.getGpxDbHelper().updateJoinSegments(dataItem, false); + } sf.setJoinSegments(dataItem.isJoinSegments()); } sf.setGpxFile(gpx, app); @@ -728,8 +732,12 @@ public class GpxSelectionHelper { } public List getPointsToDisplay() { - if (joinSegments && gpxFile != null && gpxFile.getGeneralTrack() != null) { - return gpxFile.getGeneralTrack().segments; + if (joinSegments) { + if (gpxFile != null && gpxFile.getGeneralTrack() != null) { + return gpxFile.getGeneralTrack().segments; + } else { + return Collections.emptyList(); + } } return processedPointsToDisplay; }