Fix crash at OsmandAidlApi

This commit is contained in:
Alexey Kulish 2017-05-30 12:26:10 +03:00
parent e335f09c29
commit d75ecfa084

View file

@ -88,25 +88,55 @@ public class OsmandAidlApi {
public void onDestroyMapActivity(final MapActivity mapActivity) { public void onDestroyMapActivity(final MapActivity mapActivity) {
if (refreshMapReceiver != null) { if (refreshMapReceiver != null) {
mapActivity.unregisterReceiver(refreshMapReceiver); try {
mapActivity.unregisterReceiver(refreshMapReceiver);
} catch (IllegalArgumentException e) {
e.printStackTrace();
}
refreshMapReceiver = null;
} }
if (setMapLocationReceiver != null) { if (setMapLocationReceiver != null) {
mapActivity.unregisterReceiver(setMapLocationReceiver); try {
mapActivity.unregisterReceiver(setMapLocationReceiver);
} catch (IllegalArgumentException e) {
e.printStackTrace();
}
setMapLocationReceiver = null;
} }
if (addMapWidgetReceiver != null) { if (addMapWidgetReceiver != null) {
mapActivity.unregisterReceiver(addMapWidgetReceiver); try {
mapActivity.unregisterReceiver(addMapWidgetReceiver);
} catch (IllegalArgumentException e) {
e.printStackTrace();
}
addMapWidgetReceiver = null;
} }
if (removeMapWidgetReceiver != null) { if (removeMapWidgetReceiver != null) {
mapActivity.unregisterReceiver(removeMapWidgetReceiver); try {
mapActivity.unregisterReceiver(removeMapWidgetReceiver);
} catch (IllegalArgumentException e) {
e.printStackTrace();
}
removeMapWidgetReceiver = null;
} }
widgetControls.clear(); widgetControls.clear();
if (addMapLayerReceiver != null) { if (addMapLayerReceiver != null) {
mapActivity.unregisterReceiver(addMapLayerReceiver); try {
mapActivity.unregisterReceiver(addMapLayerReceiver);
} catch (IllegalArgumentException e) {
e.printStackTrace();
}
addMapLayerReceiver = null;
} }
if (removeMapLayerReceiver != null) { if (removeMapLayerReceiver != null) {
mapActivity.unregisterReceiver(removeMapLayerReceiver); try {
mapActivity.unregisterReceiver(removeMapLayerReceiver);
} catch (IllegalArgumentException e) {
e.printStackTrace();
}
removeMapLayerReceiver = null;
} }
} }