Guard against devices not supporting mandatory ContentProvider columns.

The docs specify that this column is supposed to be present, but a
crash says it wasn't, so alas, here in goes the check.
pull/1/head
Greyson Parrelli 5 years ago
parent c4d1bdc44d
commit 33daa21ad9

@ -267,7 +267,7 @@ class MediaRepository {
if (size <= 0) {
try (Cursor cursor = context.getContentResolver().query(media.getUri(), null, null, null, null)) {
if (cursor != null && cursor.moveToFirst()) {
if (cursor != null && cursor.moveToFirst() && cursor.getColumnIndex(OpenableColumns.SIZE) >= 0) {
size = cursor.getLong(cursor.getColumnIndexOrThrow(OpenableColumns.SIZE));
}
}

Loading…
Cancel
Save