Skip to content
This repository has been archived by the owner on Oct 7, 2024. It is now read-only.

Commit

Permalink
Merge pull request #121 from mapbox/103-out-of-bounds-exception
Browse files Browse the repository at this point in the history
#103 - only remove an offline region if there is are any
  • Loading branch information
Cameron Mace authored Aug 9, 2016
2 parents 58d18b3 + 78bef60 commit bbb93b8
Showing 1 changed file with 14 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -140,19 +140,20 @@ public void onPause() {
offlineManager.listOfflineRegions(new OfflineManager.ListOfflineRegionsCallback() {
@Override
public void onList(OfflineRegion[] offlineRegions) {

// delete the last item in the offlineRegions list which will be yosemite offline map
offlineRegions[(offlineRegions.length - 1)].delete(new OfflineRegion.OfflineRegionDeleteCallback() {
@Override
public void onDelete() {
Toast.makeText(SimpleOfflineMapActivity.this, "Yosemite offline map deleted", Toast.LENGTH_LONG).show();
}

@Override
public void onError(String error) {
Log.e(TAG, "On Delete error: " + error);
}
});
if (offlineRegions.length > 0) {
// delete the last item in the offlineRegions list which will be yosemite offline map
offlineRegions[(offlineRegions.length - 1)].delete(new OfflineRegion.OfflineRegionDeleteCallback() {
@Override
public void onDelete() {
Toast.makeText(SimpleOfflineMapActivity.this, "Yosemite offline map deleted", Toast.LENGTH_LONG).show();
}

@Override
public void onError(String error) {
Log.e(TAG, "On Delete error: " + error);
}
});
}
}

@Override
Expand Down

0 comments on commit bbb93b8

Please sign in to comment.