catch all throwables when working with content provider to retrieve mime
This commit is contained in:
parent
53241f2ef1
commit
6fc67d9a60
|
@ -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();
|
||||||
|
|
Loading…
Reference in a new issue