diff --git a/app/src/main/java/org/witness/proofmode/share/ShareProofActivity.kt b/app/src/main/java/org/witness/proofmode/share/ShareProofActivity.kt index 7a56f39e..e05ee520 100644 --- a/app/src/main/java/org/witness/proofmode/share/ShareProofActivity.kt +++ b/app/src/main/java/org/witness/proofmode/share/ShareProofActivity.kt @@ -267,6 +267,8 @@ class ShareProofActivity : AppCompatActivity() { generateProof(mediaUri, proofHash, mimeType!!) } catch (fe: FileNotFoundException) { proofHash = null + } catch (se: SecurityException) { + proofHash = null } } } @@ -1175,6 +1177,8 @@ class ShareProofActivity : AppCompatActivity() { ) } catch (fe: FileNotFoundException) { Timber.d("FileNotFound: %s", mediaUri) + } catch (se: SecurityException) { + Timber.d("no access to media URI: %s", mediaUri) } } @@ -1196,6 +1200,13 @@ class ShareProofActivity : AppCompatActivity() { } catch (e: FileNotFoundException) { Timber.w(e) null + } catch (e: SecurityException) { + // The URI's read grant can be gone by the time we get here (e.g. a + // MediaStore URI shared from another app whose temporary permission + // already expired). Treat it the same as "no proof yet" instead of + // crashing the share screen. + Timber.w(e, "no access to media URI: %s", mediaUri) + null } }