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

Check for index in path node list when parsing connection #296

Merged
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
10 changes: 7 additions & 3 deletions src/trips_and_connections_cache_fetcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,10 @@ namespace TrRouting
for (unsigned long nodeTimeI = 0; nodeTimeI < nodeTimesCount - 1; nodeTimeI++)
{

try {
connections.push_back(Connection(
path.nodesRef[nodeTimeI].get(),
path.nodesRef[nodeTimeI + 1].get(),
path.nodesRef.at(nodeTimeI).get(),
path.nodesRef.at(nodeTimeI + 1).get(),
departureTimesSeconds[nodeTimeI],
arrivalTimesSeconds[nodeTimeI + 1],
trip,
Expand All @@ -116,7 +117,10 @@ namespace TrRouting
));

trip.connectionDepartureTimes[nodeTimeI] = departureTimesSeconds[nodeTimeI];

} catch (std::out_of_range const& exc) {
spdlog::error("Index out of range while parsing connection for trip on line ({})", path.line.longname);
return -1;
}
}
}
}
Expand Down
Loading