Fix intermittent crash on app close
@@ -345,7 +345,10 @@ public class MapFragment extends Fragment {
public void onDestroyView() {
super.onDestroyView();
// properly closes the cache db since it's stored in a static field in osmdroid...
+ try {
((SqlTileWriter) mapView.getTileProvider().getTileWriter()).refreshDb();
+ } catch (Exception ignored) {
+ }
mapView = null;
binding = null;
}
