Catch content resolver security exception

pull/162/head
M66B 6 years ago
parent 984c1430bf
commit 264cfc375d

@ -1840,6 +1840,7 @@ public class FragmentCompose extends FragmentBase {
String name = uri.getLastPathSegment(); String name = uri.getLastPathSegment();
String s = null; String s = null;
try {
try (Cursor cursor = context.getContentResolver().query(uri, null, null, null, null, null)) { try (Cursor cursor = context.getContentResolver().query(uri, null, null, null, null, null)) {
if (cursor != null && cursor.moveToFirst()) { if (cursor != null && cursor.moveToFirst()) {
int colName = cursor.getColumnIndex(OpenableColumns.DISPLAY_NAME); int colName = cursor.getColumnIndex(OpenableColumns.DISPLAY_NAME);
@ -1849,7 +1850,9 @@ public class FragmentCompose extends FragmentBase {
if (colSize >= 0) if (colSize >= 0)
s = cursor.getString(colSize); s = cursor.getString(colSize);
} }
}
} catch (SecurityException ex) {
Log.w(ex);
} }
DB db = DB.getInstance(context); DB db = DB.getInstance(context);
@ -1935,7 +1938,7 @@ public class FragmentCompose extends FragmentBase {
resizeAttachment(context, attachment); resizeAttachment(context, attachment);
} catch (IOException ex) { } catch (Throwable ex) {
// Reset progress on failure // Reset progress on failure
Log.e(ex); Log.e(ex);
db.attachment().setError(attachment.id, Helper.formatThrowable(ex, false)); db.attachment().setError(attachment.id, Helper.formatThrowable(ex, false));

Loading…
Cancel
Save