Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

handle missing restriction vertex, fixes #681 #826

Merged
merged 2 commits into from
Sep 20, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions src/main/java/com/conveyal/r5/streets/StreetLayer.java
Original file line number Diff line number Diff line change
Expand Up @@ -871,7 +871,12 @@ else if ("via".equals(member.role)) {
final long fromWayId = from.id; // more effectively final nonsense
final boolean[] bad = new boolean[] { false };

int fromVertex = vertexIndexForOsmNode.get(pathNodes[0]);
final long fromNode = pathNodes[0];
final int fromVertex = vertexIndexForOsmNode.get(fromNode);
if (fromVertex == -1) {
LOG.warn("Vertex not found for from-node {} of restriction {}, skipping this restriction", fromNode, osmRelationId);
return;
}

// find the edges
incomingEdges.get(fromVertex).forEach(eidx -> {
Expand All @@ -889,7 +894,12 @@ else if ("via".equals(member.role)) {
return true; // iteration should continue
});

int toVertex = vertexIndexForOsmNode.get(pathNodes[pathNodes.length - 1]);
final long toNode = pathNodes[pathNodes.length - 1];
final int toVertex = vertexIndexForOsmNode.get(toNode);
if (toVertex == -1) {
LOG.warn("Vertex not found for to-node {} of restriction {}, skipping this restriction", toNode, osmRelationId);
return;
}

final int[] toEdge = new int[] { -1 };
final long toWayId = to.id; // more effectively final nonsense
Expand Down