@@ -1169,7 +1169,7 @@ static String[] parseTags(final String tagList) {
1169
1169
}
1170
1170
1171
1171
// Find path to content: DocumentProvider, DownloadsProvider, MediaProvider, MediaStore, File.
1172
- static String getContentPath (Context context , Uri uri ) {
1172
+ static String getContentPath (@ NonNull Context context , @ NonNull Uri uri ) {
1173
1173
// DocumentProvider
1174
1174
if (DocumentsContract .isDocumentUri (context , uri )) {
1175
1175
final String docId = DocumentsContract .getDocumentId (uri );
@@ -1231,15 +1231,19 @@ static String getContentPath(Context context, Uri uri) {
1231
1231
} else if ("audio" .equals (type )) {
1232
1232
contentUri = MediaStore .Audio .Media .EXTERNAL_CONTENT_URI ;
1233
1233
}
1234
- final String selection = "_id=?" ;
1235
- final String [] selectionArgs = new String []{split [1 ]};
1236
- return getResolverData (context , contentUri , selection , selectionArgs );
1234
+ if (contentUri != null ) {
1235
+ final String selection = "_id=?" ;
1236
+ final String [] selectionArgs = new String []{split [1 ]};
1237
+ return getResolverData (context , contentUri , selection , selectionArgs );
1238
+ } else {
1239
+ Log .i (TAG , "Unknown MediaProvider type " + type );
1240
+ }
1237
1241
}
1238
1242
default :
1239
- Log .d (TAG , "Unknown content authority " + uri .getAuthority ());
1243
+ Log .i (TAG , "Unknown content authority " + uri .getAuthority ());
1240
1244
}
1241
1245
} else {
1242
- Log .d (TAG , "URI has no content authority " + uri );
1246
+ Log .i (TAG , "URI has no content authority " + uri );
1243
1247
}
1244
1248
} else if ("content" .equalsIgnoreCase (uri .getScheme ())) {
1245
1249
// MediaStore (and general)
@@ -1255,7 +1259,7 @@ static String getContentPath(Context context, Uri uri) {
1255
1259
return null ;
1256
1260
}
1257
1261
1258
- private static String getResolverData (Context context , Uri uri , String selection , String [] selectionArgs ) {
1262
+ private static String getResolverData (Context context , @ NonNull Uri uri , String selection , String [] selectionArgs ) {
1259
1263
final String column = MediaStore .Files .FileColumns .DATA ;
1260
1264
final String [] projection = {column };
1261
1265
try {
0 commit comments