From aaa61c6ec641b3a3e7ab173a1037f866e828519f Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Sun, 16 Apr 2017 13:12:09 +0300 Subject: [PATCH] Avoid out of bound exception --- OsmAnd/src/net/osmand/plus/routing/RouteProvider.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/OsmAnd/src/net/osmand/plus/routing/RouteProvider.java b/OsmAnd/src/net/osmand/plus/routing/RouteProvider.java index fa4efec487..3c74776fc6 100644 --- a/OsmAnd/src/net/osmand/plus/routing/RouteProvider.java +++ b/OsmAnd/src/net/osmand/plus/routing/RouteProvider.java @@ -1092,7 +1092,8 @@ public class RouteProvider { for (int i = cDirInfo; i < directionInfo.size(); i++) { RouteDirectionInfo dirInfo = directionInfo.get(i); if (dirInfo.routePointOffset - routePointOffsetAdjusted >= cRoute) { - if (dirInfo.getTurnType() != null && !dirInfo.getTurnType().isSkipToSpeak()) { + if (dirInfo.getTurnType() != null && !dirInfo.getTurnType().isSkipToSpeak() && + dirInfo.routePointOffset - routePointOffsetAdjusted < routeNodes.size()) { Location loc = routeNodes.get(dirInfo.routePointOffset - routePointOffsetAdjusted); WptPt pt = new WptPt(); pt.lat = loc.getLatitude();