diff --git a/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementEditingContext.java b/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementEditingContext.java index 99e16baa7b..c8e0ff043b 100644 --- a/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementEditingContext.java +++ b/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementEditingContext.java @@ -474,6 +474,10 @@ public class MeasurementEditingContext { List segments = routeImporter.importRoute(); List routePoints = gpxData.getGpxFile().getRoutePoints(); int prevPointIndex = 0; + if (routePoints.isEmpty() && points.size() > 1) { + routePoints.add(points.get(0)); + routePoints.add(points.get(points.size() - 1)); + } for (int i = 0; i < routePoints.size() - 1; i++) { Pair pair = new Pair<>(routePoints.get(i), routePoints.get(i + 1)); int startIndex = pair.first.getTrkPtIndex();