Skip to content

Commit 0e84f77

Browse files
committed
fix(permission): fix runtime exception if location permission is not granted
1 parent 038619b commit 0e84f77

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

AndroidSDK/src/com/leanplum/LocationManagerImplementation.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,11 @@ private void startLocationClient() {
241241

242242
private boolean isPermissionGranted() {
243243
Context context = Leanplum.getContext();
244-
return context.checkCallingOrSelfPermission(PERMISSION) == PackageManager.PERMISSION_GRANTED;
244+
try {
245+
return context.checkCallingOrSelfPermission(PERMISSION) == PackageManager.PERMISSION_GRANTED;
246+
} catch (RuntimeException ignored) {
247+
return false;
248+
}
245249
}
246250

247251
private boolean isMetaDataSet() {

0 commit comments

Comments
 (0)