mirror of
https://github.com/M66B/FairEmail.git
synced 2025-03-03 10:16:45 +00:00
Catch content resolver security exception
This commit is contained in:
parent
984c1430bf
commit
264cfc375d
1 changed files with 13 additions and 10 deletions
|
@ -1840,16 +1840,19 @@ public class FragmentCompose extends FragmentBase {
|
|||
String name = uri.getLastPathSegment();
|
||||
String s = null;
|
||||
|
||||
try (Cursor cursor = context.getContentResolver().query(uri, null, null, null, null, null)) {
|
||||
if (cursor != null && cursor.moveToFirst()) {
|
||||
int colName = cursor.getColumnIndex(OpenableColumns.DISPLAY_NAME);
|
||||
int colSize = cursor.getColumnIndex(OpenableColumns.SIZE);
|
||||
if (colName >= 0)
|
||||
name = cursor.getString(colName);
|
||||
if (colSize >= 0)
|
||||
s = cursor.getString(colSize);
|
||||
try {
|
||||
try (Cursor cursor = context.getContentResolver().query(uri, null, null, null, null, null)) {
|
||||
if (cursor != null && cursor.moveToFirst()) {
|
||||
int colName = cursor.getColumnIndex(OpenableColumns.DISPLAY_NAME);
|
||||
int colSize = cursor.getColumnIndex(OpenableColumns.SIZE);
|
||||
if (colName >= 0)
|
||||
name = cursor.getString(colName);
|
||||
if (colSize >= 0)
|
||||
s = cursor.getString(colSize);
|
||||
}
|
||||
}
|
||||
|
||||
} catch (SecurityException ex) {
|
||||
Log.w(ex);
|
||||
}
|
||||
|
||||
DB db = DB.getInstance(context);
|
||||
|
@ -1935,7 +1938,7 @@ public class FragmentCompose extends FragmentBase {
|
|||
|
||||
resizeAttachment(context, attachment);
|
||||
|
||||
} catch (IOException ex) {
|
||||
} catch (Throwable ex) {
|
||||
// Reset progress on failure
|
||||
Log.e(ex);
|
||||
db.attachment().setError(attachment.id, Helper.formatThrowable(ex, false));
|
||||
|
|
Loading…
Reference in a new issue