Guard against shared content not having proper permissions.

Fixes #11269
This commit is contained in:
Greyson Parrelli 2021-05-06 19:57:00 -04:00
parent ecc8d1738e
commit b4111cffef

View file

@ -89,7 +89,12 @@ class ShareRepository {
if (PartAuthority.isLocalUri(uri)) {
return ShareData.forIntentData(uri, mimeType, false, false);
} else {
InputStream stream = context.getContentResolver().openInputStream(uri);
InputStream stream = null;
try {
stream = context.getContentResolver().openInputStream(uri);
} catch (SecurityException e) {
Log.w(TAG, "Failed to read stream!", e);
}
if (stream == null) {
throw new IOException("Failed to open stream!");