From c0fe1568973b3399d0413e51c2eef386ac42ac70 Mon Sep 17 00:00:00 2001 From: Greyson Parrelli Date: Mon, 13 Feb 2023 11:47:11 -0500 Subject: [PATCH] Do not fail message inserts on bad quote attachments. Fixes #12721 --- .../securesms/database/AttachmentTable.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/org/thoughtcrime/securesms/database/AttachmentTable.java b/app/src/main/java/org/thoughtcrime/securesms/database/AttachmentTable.java index e138d2198d..5e6893f00f 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/database/AttachmentTable.java +++ b/app/src/main/java/org/thoughtcrime/securesms/database/AttachmentTable.java @@ -812,10 +812,14 @@ public class AttachmentTable extends DatabaseTable { Log.i(TAG, "Inserted attachment at ID: " + attachmentId); } - for (Attachment attachment : quoteAttachment) { - AttachmentId attachmentId = insertAttachment(mmsId, attachment, true); - insertedAttachments.put(attachment, attachmentId); - Log.i(TAG, "Inserted quoted attachment at ID: " + attachmentId); + try { + for (Attachment attachment : quoteAttachment) { + AttachmentId attachmentId = insertAttachment(mmsId, attachment, true); + insertedAttachments.put(attachment, attachmentId); + Log.i(TAG, "Inserted quoted attachment at ID: " + attachmentId); + } + } catch (MmsException e) { + Log.w(TAG, "Failed to insert quote attachment! messageId: " + mmsId); } return insertedAttachments;