Fix removeWayPoint crash

This commit is contained in:
max-klaus 2019-10-13 10:47:17 +03:00
parent 5342d4a0e2
commit a262a13fbf

View file

@ -497,11 +497,11 @@ public class TargetPointsHelper {
}
public void removeWayPoint(boolean updateRoute, int index) {
int sz = intermediatePoints.size();
if (index < 0) {
cancelTargetPointAddressRequest();
settings.clearPointToNavigate();
pointToNavigate = null;
int sz = intermediatePoints.size();
if (sz > 0) {
settings.deleteIntermediatePoint(sz - 1);
pointToNavigate = intermediatePoints.remove(sz - 1);
@ -510,7 +510,7 @@ public class TargetPointsHelper {
pointToNavigate.pointDescription);
lookupAddressForPointToNavigate();
}
} else {
} else if (sz > index) {
settings.deleteIntermediatePoint(index);
TargetPoint targetPoint = intermediatePoints.remove(index);
cancelPointAddressRequests(targetPoint.point);