Router compact legs NPE fix in AStar search. Bug fix on #2449 - #2490
Closed
t2gran wants to merge 2 commits into
Closed
Router compact legs NPE fix in AStar search. Bug fix on #2449#2490t2gran wants to merge 2 commits into
t2gran wants to merge 2 commits into
Conversation
novalis
reviewed
Sep 11, 2017
| } | ||
|
|
||
| public List<GraphPath> getPathsToTarget() { | ||
| if(runState == null) { |
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.
The PR 'Compact legs by reversed search #2449' cased a null pointer exception (npe) in the AStar class as reported by @vesameskanen. Please see the discussion in PR #2449 for details.
The NPE is occuring when the timeout is reached at the initialization point in time, and the runState is set to null:
Later when the
getPathsToTarget()is called, the result is a NPE.My approach to fix this was to do a check in the
getPathsToTarget()method and return an empty list when runState is null.This is not a robust solution - it enforces the AStar logic to make sure the runState is not null everywhere. Perhaps a better way would be to throw some kind of TimeOutException when a timeout is detected and handle this at an higher level. But, I have to say that with my limited experience with OTP, I am not comfortable to such change. Any comments on this is encouraged.