Check for valid index before updating steps in NavigationRouteProcessor#1435
Merged
Conversation
50a68e4 to
0314bd9
Compare
Contributor
Guardiola31337
left a comment
There was a problem hiding this comment.
A couple of comments @danesfeder
Also looking forward to hearing from @kevinkreiser on
something to look into here (could very well be a problem on our side) -
NavigationStatusis providing leg / step indices that are out of bounds of the current route leg / step lists.
| private void updateSteps(DirectionsRoute route, int legIndex, int stepIndex, int upcomingStepIndex) { | ||
| currentLeg = route.legs().get(legIndex); | ||
| List<RouteLeg> legs = route.legs(); | ||
| if (legIndex < legs.size()) { |
Contributor
There was a problem hiding this comment.
Scratch this, it's 👌
| } | ||
| List<LegStep> steps = currentLeg.steps(); | ||
| currentStep = steps.get(stepIndex); | ||
| if (stepIndex < steps.size()) { |
Contributor
There was a problem hiding this comment.
Scratch this, it's 👌
0314bd9 to
867f593
Compare
Guardiola31337
approved these changes
Oct 18, 2018
Contributor
Guardiola31337
left a comment
There was a problem hiding this comment.
Sounds good to me, although as I noted I'm curious about how the indices could get out of sync 🤔 cc @kevinkreiser
Contributor
|
yeah they should not be out of sync, im going to do some 🔍 on this! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1413
This could be a data edge case with
MapMatchinggiven @Danny-James setup, but still something we should guard against.cc @kevinkreiser something to look into here (could very well be a problem on our side) -
NavigationStatusis providing leg / step indices that are out of bounds of the current route leg / step lists.