From 31970c4644552e1e3effd4c97f343dda204531eb Mon Sep 17 00:00:00 2001 From: Marcus Ofenhed Date: Tue, 12 Apr 2016 08:40:48 +0200 Subject: [PATCH] Stop crash on multiple attachment selected Fixed #5272 Closes #5440 // FREEBIE --- src/org/thoughtcrime/securesms/ConversationActivity.java | 1 + src/org/thoughtcrime/securesms/util/MediaUtil.java | 2 ++ 2 files changed, 3 insertions(+) diff --git a/src/org/thoughtcrime/securesms/ConversationActivity.java b/src/org/thoughtcrime/securesms/ConversationActivity.java index 566b81f5ed..0b27c133c1 100644 --- a/src/org/thoughtcrime/securesms/ConversationActivity.java +++ b/src/org/thoughtcrime/securesms/ConversationActivity.java @@ -1059,6 +1059,7 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity } private void setMedia(Uri uri, MediaType mediaType) { + if (uri == null) return; attachmentManager.setMedia(masterSecret, uri, mediaType, getCurrentMediaConstraints()); } diff --git a/src/org/thoughtcrime/securesms/util/MediaUtil.java b/src/org/thoughtcrime/securesms/util/MediaUtil.java index 883a2787fc..0d04f0b533 100644 --- a/src/org/thoughtcrime/securesms/util/MediaUtil.java +++ b/src/org/thoughtcrime/securesms/util/MediaUtil.java @@ -72,6 +72,8 @@ public class MediaUtil { } public static @Nullable String getMimeType(Context context, Uri uri) { + if (uri == null) return null; + if (PersistentBlobProvider.isAuthority(context, uri)) { return PersistentBlobProvider.getMimeType(context, uri); }