[android] Fixed crash when try to get absolute path

This commit is contained in:
Dmitry Donskoy 2018-08-21 19:20:54 +03:00 committed by Aleksandr Zatsepin
parent bc3d8c4476
commit 41260225e6

View file

@ -89,7 +89,8 @@ public class SystemDownloadCompletedService extends JobIntentService
@Nullable
private static String getFilePath(@NonNull Cursor cursor) throws IOException
{
return getColumnValue(cursor, DownloadManager.COLUMN_LOCAL_FILENAME);
String localUri = getColumnValue(cursor, DownloadManager.COLUMN_LOCAL_URI);
return localUri == null ? null : Uri.parse(localUri).getPath();
}
@Nullable