Skip to content

Commit 27fa8f1

Browse files
authored
Merge pull request #73 from kholiavko-roman/master
FIX: Fatal Exception: java.lang.IllegalArgumentException in forceCloseDialog
2 parents 4a899ab + a5595b5 commit 27fa8f1

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

android/src/main/java/com/showlocationservicesdialogbox/LocationServicesDialogBoxModule.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,11 @@ public void checkLocationServicesIsEnabled(ReadableMap configMap, Promise promis
4848

4949
@ReactMethod
5050
public void forceCloseDialog() {
51-
if (alertDialog != null && promiseCallback != null) {
52-
alertDialog.cancel();
53-
}
51+
try {
52+
if (alertDialog != null && alertDialog.isShowing() && promiseCallback != null) {
53+
alertDialog.cancel();
54+
}
55+
} catch (Exception ignored) {}
5456
}
5557

5658
@ReactMethod

0 commit comments

Comments
 (0)