From 1decb4e9fd0daa655ae7788e053fafa628425bd0 Mon Sep 17 00:00:00 2001 From: PavelRatushny Date: Mon, 4 Sep 2017 10:25:14 +0300 Subject: [PATCH] Fix exiting from snap to road --- .../plus/measurementtool/MeasurementEditingContext.java | 6 ++++-- .../plus/measurementtool/MeasurementToolFragment.java | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementEditingContext.java b/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementEditingContext.java index 8517b88319..5ffca2ee76 100644 --- a/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementEditingContext.java +++ b/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementEditingContext.java @@ -180,8 +180,10 @@ public class MeasurementEditingContext { before.points.clear(); after.points.clear(); if (inSnapToRoadMode) { - beforeCacheForSnap.points.clear(); - afterCacheForSnap.points.clear(); + if (beforeCacheForSnap != null && afterCacheForSnap != null) { + beforeCacheForSnap.points.clear(); + afterCacheForSnap.points.clear(); + } needUpdateCacheForSnap = true; } else { beforeCacheForSnap = null; diff --git a/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java b/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java index 993bb03000..f6f3919065 100644 --- a/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java +++ b/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java @@ -1395,7 +1395,7 @@ public class MeasurementToolFragment extends Fragment { hidePointsList(); return; } - if (editingCtx.getPointsCount() < 1 || saved) { + if (editingCtx.getPointsCount() == 0 || saved) { dismiss(mapActivity); return; }