Skip to content

Commit

Permalink
Merge pull request #9233 from brave/hf-check-permission-crash
Browse files Browse the repository at this point in the history
[Android] fixes check permission crash
  • Loading branch information
alexsafe authored Jun 24, 2021
2 parents 994390e + 0161909 commit e8b5121
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,10 @@ private static Bitmap convertToBitmap(View view) {
}

public static boolean hasWritePermission(Activity activity) {
if (ActivityCompat.checkSelfPermission(activity, Manifest.permission.WRITE_EXTERNAL_STORAGE)
if (activity == null) {
return false;
}
if (activity.checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE)
== PackageManager.PERMISSION_GRANTED) {
return true;
}
Expand Down

0 comments on commit e8b5121

Please sign in to comment.