diff --git a/OsmAnd-java/src/net/osmand/router/BinaryRoutePlanner.java b/OsmAnd-java/src/net/osmand/router/BinaryRoutePlanner.java index 8da0c6048b..8e03bb83b9 100644 --- a/OsmAnd-java/src/net/osmand/router/BinaryRoutePlanner.java +++ b/OsmAnd-java/src/net/osmand/router/BinaryRoutePlanner.java @@ -217,9 +217,9 @@ public class BinaryRoutePlanner { public RouteSegment initRouteSegment(final RoutingContext ctx, RouteSegment segment, boolean positiveDirection) { if (segment.getSegmentStart() == 0 && !positiveDirection && segment.getRoad().getPointsLength() > 0) { segment = loadSameSegment(ctx, segment, 1); - //} else if (segment.getSegmentStart() == segment.getRoad().getPointsLength() - 1 && positiveDirection && segment.getSegmentStart() > 0) { +// } else if (segment.getSegmentStart() == segment.getRoad().getPointsLength() - 1 && positiveDirection && segment.getSegmentStart() > 0) { // assymetric cause we calculate initial point differently (segmentStart means that point is between ]segmentStart-1, segmentStart] - } else if (segment.getSegmentStart() > 0 && positiveDirection && segment.getSegmentStart() > 0) { + } else if (segment.getSegmentStart() > 0 && positiveDirection) { segment = loadSameSegment(ctx, segment, segment.getSegmentStart() - 1); } if (segment == null) { @@ -727,12 +727,13 @@ public class BinaryRoutePlanner { .getPoint31YTile(segmentPoint), targetEndX, targetEndY); // Calculate possible ways to put into priority queue RouteSegment next = inputNext; - boolean hasNext = nextIterator == null || nextIterator.hasNext(); + boolean hasNext = nextIterator != null ? nextIterator.hasNext() : next != null; while (hasNext) { if (nextIterator != null) { next = nextIterator.next(); } - if (next.getSegmentStart() == segmentPoint && next.getRoad().getId() == segment.getRoad().id) { + if (next.getSegmentStart() == segmentPoint && + next.getRoad().getId() == segment.getRoad().id) { // find segment itself // (and process it as other with small exception that we don't add to graph segments and process immediately) itself = next.initRouteSegment(segment.isPositive()); diff --git a/OsmAnd-java/test/java/net/osmand/router/RouteResultPreparationTest.java b/OsmAnd-java/test/java/net/osmand/router/RouteResultPreparationTest.java index f2ba068770..c864a4685a 100644 --- a/OsmAnd-java/test/java/net/osmand/router/RouteResultPreparationTest.java +++ b/OsmAnd-java/test/java/net/osmand/router/RouteResultPreparationTest.java @@ -86,7 +86,6 @@ public class RouteResultPreparationTest { @Test public void testLanes() throws Exception { - List routeSegments = fe.searchRoute(ctx, startPoint, endPoint, null); Set reachedSegments = new TreeSet(); Assert.assertNotNull(routeSegments);