[geary] Avoid database error when adding attachments
- From: Jim Nelson <jnelson src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary] Avoid database error when adding attachments
- Date: Tue, 13 Jan 2015 21:56:53 +0000 (UTC)
commit ee7efd3a93eb3e051990bca45014255e21dc978a
Author: Jim Nelson <jim yorba org>
Date: Tue Jan 13 13:51:28 2015 -0800
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 files 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 422c395..e1b5abe 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());
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]