diff --git a/android/src/main/java/studio/midoridesign/gal/GalPlugin.java b/android/src/main/java/studio/midoridesign/gal/GalPlugin.java index 48c0816a..fdc32877 100644 --- a/android/src/main/java/studio/midoridesign/gal/GalPlugin.java +++ b/android/src/main/java/studio/midoridesign/gal/GalPlugin.java @@ -208,8 +208,11 @@ public void onDetachedFromActivityForConfigChanges() { @Override public boolean onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) { + if (requestCode != PERMISSION_REQUEST_CODE || grantResults.length == 0) { + return false; + } accessRequestResult.complete( - grantResults[0] == PackageManager.PERMISSION_GRANTED && PERMISSION_REQUEST_CODE == requestCode); + grantResults[0] == PackageManager.PERMISSION_GRANTED); return true; }