From 8fcf52697f1eeb88e8a5f97c87cde0cc0cf9dfcc Mon Sep 17 00:00:00 2001 From: Alexey Kulish Date: Thu, 30 Mar 2017 10:10:38 +0300 Subject: [PATCH] Fix #3584 --- .../src/net/osmand/plus/activities/SavingTrackHelper.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/activities/SavingTrackHelper.java b/OsmAnd/src/net/osmand/plus/activities/SavingTrackHelper.java index 3c92058699..287dae096a 100644 --- a/OsmAnd/src/net/osmand/plus/activities/SavingTrackHelper.java +++ b/OsmAnd/src/net/osmand/plus/activities/SavingTrackHelper.java @@ -422,9 +422,10 @@ public class SavingTrackHelper extends SQLiteOpenHelper { if (points.size() == 0 || newSegment) { points.add(new TrkSegment()); } - if(track.segments.size() == 0 || newSegment) { + boolean segmentAdded = false; + if (track.segments.size() == 0 || newSegment) { track.segments.add(new TrkSegment()); - currentTrack.processPoints(); + segmentAdded = true; } if (pt != null) { int ind = points.size() - 1; @@ -433,6 +434,9 @@ public class SavingTrackHelper extends SQLiteOpenHelper { TrkSegment lt = track.segments.get(track.segments.size() - 1); lt.points.add(pt); } + if (segmentAdded) { + currentTrack.processPoints(); + } currentTrack.getModifiableGpxFile().modifiedTime = time; }