fix a crash in MediaUtils
This commit is contained in:
parent
e1473c2142
commit
3690e86312
|
@ -70,7 +70,12 @@ public class MediaUtils {
|
|||
public static long getMediaSize(@NonNull ContentResolver contentResolver, @Nullable Uri uri) {
|
||||
if(uri == null) return MEDIA_SIZE_UNKNOWN;
|
||||
long mediaSize;
|
||||
Cursor cursor = contentResolver.query(uri, null, null, null, null);
|
||||
Cursor cursor;
|
||||
try {
|
||||
cursor = contentResolver.query(uri, null, null, null, null);
|
||||
} catch (SecurityException e) {
|
||||
return MEDIA_SIZE_UNKNOWN;
|
||||
}
|
||||
if (cursor != null) {
|
||||
int sizeIndex = cursor.getColumnIndex(OpenableColumns.SIZE);
|
||||
cursor.moveToFirst();
|
||||
|
|
Loading…
Reference in New Issue