Skip to content

Commit

Permalink
Catch index out of bound
Browse files Browse the repository at this point in the history
  • Loading branch information
bezloginu committed Jul 2, 2017
1 parent 15875a1 commit 478c5f1
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,12 @@ public int onStartCommand(Intent intent, int flags, int startId) {
@Override
public void onLocationChanged(Location location) {
if(location.hasSpeed() && mAutoVolumeManager.isActive()) {
final int speedKph = (int)((location.getSpeed() * 3600) / 1000);
mAutoVolumeManager.adjustVolumeForSpeed(speedKph);
try {
final int speedKph = (int) ((location.getSpeed() * 3600) / 1000);
mAutoVolumeManager.adjustVolumeForSpeed(speedKph);
} catch(IndexOutOfBoundsException e) {
e.printStackTrace();
}
}
}

Expand Down

0 comments on commit 478c5f1

Please sign in to comment.