forked from organicmaps/organicmaps
[android] Fix a crash in LocationHelper.attach()
Closes #4240 Signed-off-by: Roman Tsisyk <roman@tsisyk.com>
This commit is contained in:
parent
d363a822c3
commit
e49708808e
1 changed files with 8 additions and 2 deletions
|
@ -567,7 +567,10 @@ public enum LocationHelper implements Initializable<Context>, AppBackgroundTrack
|
|||
Logger.d(TAG, "activity = " + activity);
|
||||
|
||||
if (mActivity != null)
|
||||
throw new IllegalStateException("Another Activity is already attached");
|
||||
{
|
||||
Logger.e(TAG, "Another Activity = " + mActivity + " is already attached");
|
||||
detach();
|
||||
}
|
||||
|
||||
mActivity = activity;
|
||||
|
||||
|
@ -586,7 +589,10 @@ public enum LocationHelper implements Initializable<Context>, AppBackgroundTrack
|
|||
Logger.d(TAG, "activity = " + mActivity);
|
||||
|
||||
if (mActivity == null)
|
||||
throw new IllegalStateException("Activity is not attached");
|
||||
{
|
||||
Logger.e(TAG, "Activity is not attached");
|
||||
return;
|
||||
}
|
||||
|
||||
assert mPermissionRequest != null;
|
||||
mPermissionRequest.unregister();
|
||||
|
|
Loading…
Add table
Reference in a new issue