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

Add bounds checking to extractSubroute. #486

Merged
merged 2 commits into from
Sep 21, 2017

Conversation

malban
Copy link

@malban malban commented Sep 20, 2017

Add bounds checking to extractSubroute to handle start and end positions being out of order.

{
return true;
}

Copy link

@kriskozak kriskozak Sep 21, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you ask me to review this just to see if I was paying attention?

I'm not sure I follow all of the logic here 100%, but for this part, does this actually constitute a success? Or did you mean to return false. If it's fine, should you have cleared sub_route.points sub_route.points.clear() before returning here or up at the top of this function?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it should return true. We asked for an empty subroute and we return an empty subtoute. Success!

The use case I'm thinking of is that a user requests a subroute that is [route start, route_end - 50m). If the route is less than 50m then this would be an empty route, which would not be a failure and would be the intuitive result.

@elliotjo
Copy link
Contributor

elliotjo commented Sep 21, 2017 via email

@malban
Copy link
Author

malban commented Sep 21, 2017

@elliotjo I think you're right the route points should be cleared in case the output variable wasn't clean to begin with. Does the rebuildPointIndex function need to get called then?

@elliotjo
Copy link
Contributor

elliotjo commented Sep 21, 2017 via email

@malban malban merged commit 15c606a into swri-robotics:master Sep 21, 2017
@malban malban deleted the check-bounds branch September 21, 2017 19:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants