catch all throwables when working with content provider to retrieve mime

This commit is contained in:
Daniel Gultsch 2017-02-07 10:19:45 +01:00
parent 53241f2ef1
commit 6fc67d9a60

View file

@ -490,7 +490,12 @@ public final class MimeUtils {
public static String guessMimeTypeFromUri(Context context, Uri uri) { public static String guessMimeTypeFromUri(Context context, Uri uri) {
// try the content resolver // try the content resolver
String mimeType = context.getContentResolver().getType(uri); String mimeType;
try {
mimeType = context.getContentResolver().getType(uri);
} catch (Throwable throwable) {
mimeType = null;
}
// try the extension // try the extension
if (mimeType == null && uri.getPath() != null) { if (mimeType == null && uri.getPath() != null) {
String path = uri.getPath(); String path = uri.getPath();