Skip to content

Commit

Permalink
Merge pull request #48 from natsuk4ze/Fix-NullPointerException-onRequ…
Browse files Browse the repository at this point in the history
…estPermissionsResult

Return false when request code invalid
  • Loading branch information
natsuk4ze authored Jul 19, 2023
2 parents 6596073 + 66c1d72 commit 9959ea0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion android/src/main/java/studio/midoridesign/gal/GalPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 9959ea0

Please sign in to comment.