From ee7efd3a93eb3e051990bca45014255e21dc978a Mon Sep 17 00:00:00 2001 From: Jim Nelson Date: Tue, 13 Jan 2015 13:51:28 -0800 Subject: [PATCH] Avoid database error when adding attachments do_save_attachments() is called by schema update 22, which is prior to when DeleteAttachmentFileTable was introduced (in update 24). Ignore error if cannot remove from that table, i.e. it doesn't exist yet. --- src/engine/imap-db/imap-db-folder.vala | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/engine/imap-db/imap-db-folder.vala b/src/engine/imap-db/imap-db-folder.vala index 422c3956..e1b5abed 100644 --- a/src/engine/imap-db/imap-db-folder.vala +++ b/src/engine/imap-db/imap-db-folder.vala @@ -1990,13 +1990,19 @@ private class Geary.ImapDB.Folder : BaseObject, Geary.ReferenceSemantics { attachment_id, filename); // On the off-chance this is marked for deletion, unmark it - stmt = cx.prepare(""" - DELETE FROM DeleteAttachmentFileTable - WHERE filename = ? - """); - stmt.bind_string(0, saved_file.get_path()); - - stmt.exec(cancellable); + try { + stmt = cx.prepare(""" + DELETE FROM DeleteAttachmentFileTable + WHERE filename = ? + """); + stmt.bind_string(0, saved_file.get_path()); + + stmt.exec(cancellable); + } catch (Error err) { + debug("Unable to delete from DeleteAttachmentFileTable: %s", err.message); + + // not a deal-breaker, fall through + } debug("Saving attachment to %s", saved_file.get_path());