From 2c6dc292a81837b8aa01c9c2664b592d8983797f 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();