Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Unexpected App Crash #11473

Closed
kalimar opened this issue Mar 16, 2018 · 2 comments
Closed

Unexpected App Crash #11473

kalimar opened this issue Mar 16, 2018 · 2 comments
Labels
Android Mapbox Maps SDK for Android needs information

Comments

@kalimar
Copy link

kalimar commented Mar 16, 2018

Platform: Android
Mapbox SDK version: mapbox-android-sdk:5.5.0

Steps to trigger behavior

Unknown specifics. Possibly on exiting the activity.

Since March13 we are seeing a crash :

Fatal Exception: java.lang.Error
Bad optional Access
com.mapbox.mapboxsdk.storage.FileSource.deactivate (FileSource.java)
com.mapbox.mapboxsdk.maps.MapView.onStop (MapView.java:394)
com.ancestry.ancestrydna.activities.kitResults.ethnicity.view.EthnicityMapActivity.onStop (EthnicityMapActivity.java:693)

And the code where it happens :

@Overrideprotected void onStop() { super.onStop();
if (mMap != null) { mMap.onStop(); }
}

And if we look deeper into the mMap.onStop() we get to MapView.java

/** * You must call this method from the parent's Activity#onStop() or Fragment#onStop(). */@UiThreadpublic void onStop() { if (mapboxMap != null) { // map was destroyed before it was started mapboxMap.onStop(); } if (mapRenderer != null) { mapRenderer.onStop(); } ConnectivityReceiver.instance(getContext()).deactivate(); FileSource.getInstance(getContext()).deactivate();}

And apparently the line FileSource.getInstance(getContext()).deactivate(); make the error

@kalimar kalimar added Android Mapbox Maps SDK for Android needs information labels Mar 16, 2018
@tobrun tobrun added this to the android-v5.5.1 milestone Mar 19, 2018
@tobrun
Copy link
Member

tobrun commented Mar 19, 2018

I expect that this can occur by closing an activity before it was fully created. We need to check if the optional has a value before accessing it. Adding this to the milestone for a patch release.

@tobrun
Copy link
Member

tobrun commented Mar 19, 2018

fix landed with #11480 and will ship with the upcoming 5.5.1 release.

@tobrun tobrun closed this as completed Mar 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Android Mapbox Maps SDK for Android needs information
Projects
None yet
Development

No branches or pull requests

2 participants