fixed NPE in CandidateChooserImpl

This commit is contained in:
Axel Uhl committed 2015-06-18 00:24:40 +02:00
1 parent 39baea5873
commit 1579d0ef26
1 file changed
+9 -7
@@ -307,13 +307,15 @@ public class CandidateChooserImpl implements CandidateChooser {
// currentCheapestEdge.getEnd(), summing up their cost with the cost required
// to reach currentCheapestEdge.getEnd()
Set<Edge> edgesForNewCandidate = allCompetitorEdges.get(currentCheapestEdge.getEnd());
for (Edge e : edgesForNewCandidate) {
int oneBasedIndexOfEndOfEdge = e.getEnd().getOneBasedIndexOfWaypoint();
// only add edge if it stays within the current segment, not exceeding
// the next fixed mark passing
if (oneBasedIndexOfEndOfEdge <= indexOfEndOfFixedInterval
&& (oneBasedIndexOfEndOfEdge < oneBasedIndexOfSuppressedWaypoint || e.getEnd() == end)) {
currentEdgesCheapestFirst.add(new Util.Pair<Edge, Double>(e, currentCheapestCost + e.getCost()));
if (edgesForNewCandidate != null) {
for (Edge e : edgesForNewCandidate) {
int oneBasedIndexOfEndOfEdge = e.getEnd().getOneBasedIndexOfWaypoint();
// only add edge if it stays within the current segment, not exceeding
// the next fixed mark passing
if (oneBasedIndexOfEndOfEdge <= indexOfEndOfFixedInterval
&& (oneBasedIndexOfEndOfEdge < oneBasedIndexOfSuppressedWaypoint || e.getEnd() == end)) {
currentEdgesCheapestFirst.add(new Util.Pair<Edge, Double>(e, currentCheapestCost + e.getCost()));
}
}
}
}