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 check to avoid ArrayIndexOutOfBoundsExceptions from MapRouteLine#drawWayPoints #1951

Merged
merged 1 commit into from
May 29, 2019

Conversation

Guardiola31337
Copy link
Contributor

@Guardiola31337 Guardiola31337 commented May 29, 2019

Description

Fixes #1948
Regression from #1387

  • I have added any issue links
  • I have added all related labels (bug, feature, new API(s), SEMVER, etc.)
  • I have added the appropriate milestone and project boards

Goal

Adds a check to avoid ArrayIndexOutOfBoundsExceptions from MapRouteLine#drawWayPoints

Implementation

Adds a check into MapRouteLine#updatePrimaryRouteIndex to cover the scenario for when newPrimaryIndex is not valid - could be -1 if not found 👀

Testing

Please describe the manual tests that you ran to verify your changes

  • I have tested locally (including SNAPSHOT upstream dependencies if needed) through testapp/demo app and run all activities to avoid regressions
  • I have tested via a test drive, or a simulation/mock location app
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have updated the CHANGELOG including this PR

@@ -202,7 +202,7 @@ boolean retrieveVisibility() {

boolean updatePrimaryRouteIndex(int primaryRouteIndex) {
boolean isNewIndex = this.primaryRouteIndex != primaryRouteIndex
&& primaryRouteIndex < directionsRoutes.size();
&& primaryRouteIndex < directionsRoutes.size() && primaryRouteIndex > 0;
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be >=0 ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, you're right! Great catch!

@codecov-io
Copy link

Codecov Report

Merging #1951 into master will increase coverage by 0.02%.
The diff coverage is 0%.

@@             Coverage Diff              @@
##             master    #1951      +/-   ##
============================================
+ Coverage     36.93%   36.96%   +0.02%     
- Complexity     1130     1133       +3     
============================================
  Files           273      273              
  Lines          9080     9080              
  Branches        677      677              
============================================
+ Hits           3354     3356       +2     
+ Misses         5427     5426       -1     
+ Partials        299      298       -1

@Guardiola31337 Guardiola31337 merged commit d447d41 into master May 29, 2019
@Guardiola31337 Guardiola31337 deleted the pg-1948-routeline-aioobe branch May 29, 2019 20:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Defect to be fixed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ArrayIndexOutOfBoundsException MapRouteLine.drawWayPoints
3 participants