diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationActivityV2.kt b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationActivityV2.kt index 4e0c1329f3..9bbbc787ef 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationActivityV2.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationActivityV2.kt @@ -735,9 +735,10 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe private fun restoreDraftIfNeeded() { val mediaURI = intent.data val mediaType = AttachmentManager.MediaType.from(intent.type) + val mimeType = MediaUtil.getMimeType(this, mediaURI) if (mediaURI != null && mediaType != null) { - if (AttachmentManager.MediaType.IMAGE == mediaType || AttachmentManager.MediaType.GIF == mediaType || AttachmentManager.MediaType.VIDEO == mediaType) { - val media = Media(mediaURI, MediaUtil.getMimeType(this, mediaURI)!!, 0, 0, 0, 0, Optional.absent(), Optional.absent()) + if (mimeType != null && (AttachmentManager.MediaType.IMAGE == mediaType || AttachmentManager.MediaType.GIF == mediaType || AttachmentManager.MediaType.VIDEO == mediaType)) { + val media = Media(mediaURI, mimeType, 0, 0, 0, 0, Optional.absent(), Optional.absent()) startActivityForResult(MediaSendActivity.buildEditorIntent(this, listOf( media ), viewModel.recipient!!, ""), PICK_FROM_LIBRARY) return } else { diff --git a/app/src/main/java/org/thoughtcrime/securesms/database/model/ThreadRecord.java b/app/src/main/java/org/thoughtcrime/securesms/database/model/ThreadRecord.java index d91f4c428c..c022598d2c 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/database/model/ThreadRecord.java +++ b/app/src/main/java/org/thoughtcrime/securesms/database/model/ThreadRecord.java @@ -144,14 +144,17 @@ public class ThreadRecord extends DisplayRecord { .format().toString(); } else if (MmsSmsColumns.Types.isMessageRequestResponse(type)) { - if (lastMessage.getRecipient().getAddress().serialize().equals( - TextSecurePreferences.getLocalNumber(context))) { - return UtilKt.getSubbedCharSequence( - context, - R.string.messageRequestYouHaveAccepted, - new Pair<>(NAME_KEY, getName()) - ); + try { + if (lastMessage.getRecipient().getAddress().serialize().equals( + TextSecurePreferences.getLocalNumber(context))) { + return UtilKt.getSubbedCharSequence( + context, + R.string.messageRequestYouHaveAccepted, + new Pair<>(NAME_KEY, getName()) + ); + } } + catch (Exception e){} // the above can throw a null exception return context.getString(R.string.messageRequestsAccepted); } else if (getCount() == 0) {