Fixing Crashes

This commit is contained in:
ThomasSession 2024-10-04 12:50:49 +10:00
parent b237faa21d
commit 8fec296c11
2 changed files with 13 additions and 9 deletions

View File

@ -735,9 +735,10 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe
private fun restoreDraftIfNeeded() { private fun restoreDraftIfNeeded() {
val mediaURI = intent.data val mediaURI = intent.data
val mediaType = AttachmentManager.MediaType.from(intent.type) val mediaType = AttachmentManager.MediaType.from(intent.type)
val mimeType = MediaUtil.getMimeType(this, mediaURI)
if (mediaURI != null && mediaType != null) { if (mediaURI != null && mediaType != null) {
if (AttachmentManager.MediaType.IMAGE == mediaType || AttachmentManager.MediaType.GIF == mediaType || AttachmentManager.MediaType.VIDEO == mediaType) { if (mimeType != null && (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()) val media = Media(mediaURI, mimeType, 0, 0, 0, 0, Optional.absent(), Optional.absent())
startActivityForResult(MediaSendActivity.buildEditorIntent(this, listOf( media ), viewModel.recipient!!, ""), PICK_FROM_LIBRARY) startActivityForResult(MediaSendActivity.buildEditorIntent(this, listOf( media ), viewModel.recipient!!, ""), PICK_FROM_LIBRARY)
return return
} else { } else {

View File

@ -144,14 +144,17 @@ public class ThreadRecord extends DisplayRecord {
.format().toString(); .format().toString();
} else if (MmsSmsColumns.Types.isMessageRequestResponse(type)) { } else if (MmsSmsColumns.Types.isMessageRequestResponse(type)) {
if (lastMessage.getRecipient().getAddress().serialize().equals( try {
TextSecurePreferences.getLocalNumber(context))) { if (lastMessage.getRecipient().getAddress().serialize().equals(
return UtilKt.getSubbedCharSequence( TextSecurePreferences.getLocalNumber(context))) {
context, return UtilKt.getSubbedCharSequence(
R.string.messageRequestYouHaveAccepted, context,
new Pair<>(NAME_KEY, getName()) R.string.messageRequestYouHaveAccepted,
); new Pair<>(NAME_KEY, getName())
);
}
} }
catch (Exception e){} // the above can throw a null exception
return context.getString(R.string.messageRequestsAccepted); return context.getString(R.string.messageRequestsAccepted);
} else if (getCount() == 0) { } else if (getCount() == 0) {