[geary] Avoid a crash when "database disk image is malformed" error	occurs.
- From: Adam Dingle <adamd src gnome org>
- To: commits-list gnome org
- Cc: 
- Subject: [geary] Avoid a crash when "database disk image is malformed" error	occurs.
- Date: Thu,  5 May 2016 11:45:33 +0000 (UTC)
commit 3b87cab5ea7d0d20629c610c883274b1c18caef5
Author: Michael James Gratton <mike vee net>
Date:   Mon May 2 18:13:11 2016 +1000
    Avoid a crash when "database disk image is malformed" error occurs.
    
    Bug 765515.
    
    * src/engine/imap-db/imap-db-account.vala
      (Geary.ImapDB.Account::do_get_search_matches): Check the query actually
      returned valid FTS offsets before attempting to use them.
 src/engine/imap-db/imap-db-account.vala |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/src/engine/imap-db/imap-db-account.vala b/src/engine/imap-db/imap-db-account.vala
index 5a6c027..60789d6 100644
--- a/src/engine/imap-db/imap-db-account.vala
+++ b/src/engine/imap-db/imap-db-account.vala
@@ -1838,6 +1838,15 @@ private class Geary.ImapDB.Account : BaseObject {
             assert(id_map.has_key(docid));
             ImapDB.EmailIdentifier id = id_map.get(docid);
             
+            // XXX Avoid a crash when "database disk image is
+            // malformed" error occurs. Remove this when the SQLite
+            // bug is fixed. See b.g.o #765515 for more info.
+            if (result.string_at(1) == null) {
+                debug("Avoiding a crash from 'database disk image is malformed' error\n");
+                result.next(cancellable);
+                continue;
+            }
+            
             // offsets() function returns a list of 4 strings that are ints indicating position
             // and length of match string in search table corpus
             string[] offset_array = result.nonnull_string_at(1).split(" ");
[
Date Prev][
Date Next]   [
Thread Prev][
Thread Next]   
[
Thread Index]
[
Date Index]
[
Author Index]