mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-24 16:57:50 +00:00
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.
This commit is contained in:
parent
c4d1bdc44d
commit
33daa21ad9
@ -267,7 +267,7 @@ class MediaRepository {
|
|||||||
|
|
||||||
if (size <= 0) {
|
if (size <= 0) {
|
||||||
try (Cursor cursor = context.getContentResolver().query(media.getUri(), null, null, null, null)) {
|
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));
|
size = cursor.getLong(cursor.getColumnIndexOrThrow(OpenableColumns.SIZE));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user