Skip to content

Commit

Permalink
Do not crash if cannot get a photo URI long permission
Browse files Browse the repository at this point in the history
  • Loading branch information
e-marchand committed Mar 25, 2024
1 parent e5b2058 commit b17030a
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,11 @@ class MainActivity :

if (resultCode == Activity.RESULT_OK) {
val selectedUri: Uri = data?.data ?: return
contentResolver.takePersistableUriPermission(selectedUri, Intent.FLAG_GRANT_READ_URI_PERMISSION)
try {
contentResolver.takePersistableUriPermission(selectedUri, Intent.FLAG_GRANT_READ_URI_PERMISSION)
} catch (e: Exception) {
Timber.i(e)
}
}
}
override fun onCreate(savedInstanceState: Bundle?) {
Expand Down

0 comments on commit b17030a

Please sign in to comment.