From 6fc67d9a60fea3e11143a7e9ab66bc229cf38fc5 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Tue, 7 Feb 2017 10:19:45 +0100 Subject: [PATCH] catch all throwables when working with content provider to retrieve mime --- src/main/java/eu/siacs/conversations/utils/MimeUtils.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/eu/siacs/conversations/utils/MimeUtils.java b/src/main/java/eu/siacs/conversations/utils/MimeUtils.java index b65eb73cd..64776f59c 100644 --- a/src/main/java/eu/siacs/conversations/utils/MimeUtils.java +++ b/src/main/java/eu/siacs/conversations/utils/MimeUtils.java @@ -490,7 +490,12 @@ public final class MimeUtils { public static String guessMimeTypeFromUri(Context context, Uri uri) { // 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 if (mimeType == null && uri.getPath() != null) { String path = uri.getPath();