Catch NullPointerException when unregistering locationManager

This commit is contained in:
Adam Jones 2016-06-09 13:21:25 +01:00
parent 8bf9808cfc
commit 6adf78bec9

View file

@ -307,9 +307,13 @@ public class ShareActivity
@Override @Override
public void onPause() { public void onPause() {
super.onPause(); super.onPause();
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M || ContextCompat.checkSelfPermission(this,
Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED) { try {
imageObj.unregisterLocationManager(); imageObj.unregisterLocationManager();
Log.d(TAG, "Unregistered locationManager");
}
catch (NullPointerException e) {
Log.d(TAG, "locationManager does not exist, not unregistered");
} }
} }