Fall back to writing to file if _data column does not exist (#817)

* Fall back to writting to file if _data column does not exist

* Fix spelling
This commit is contained in:
Andrew Shini 2018-09-07 18:28:44 +10:00 committed by Ivan Pusic
parent fab0164e1b
commit a0e7f820c6

View File

@ -146,8 +146,9 @@ class RealPathUtil {
cursor = context.getContentResolver().query(uri, projection, selection, selectionArgs,
null);
if (cursor != null && cursor.moveToFirst()) {
final int index = cursor.getColumnIndexOrThrow(MediaStore.MediaColumns.DATA);
String path = cursor.getString(index);
// Fall back to writing to file if _data column does not exist
final int index = cursor.getColumnIndex(MediaStore.MediaColumns.DATA);
String path = index > -1 ? cursor.getString(index) : null;
if (path != null) {
return cursor.getString(index);
} else {