[evolution-data-server/openismus-work-3-8: 114/116] EBookBackendSqliteDB: Fixed upgrade_contacts() for cases with missing vcards.



commit c4288a1406efffb6a221b2dc9637ff1edd351207
Author: Tristan Van Berkom <tristanvb openismus com>
Date:   Sat Sep 28 01:16:57 2013 +0200

    EBookBackendSqliteDB: Fixed upgrade_contacts() for cases with missing vcards.
    
    This patch avoids critical warnings to be fired when opening an old summary
    mode SQLite whilst upgrading/migrating an addressbook from EDS <= 3.6.

 .../libedata-book/e-book-backend-sqlitedb.c        |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)
---
diff --git a/addressbook/libedata-book/e-book-backend-sqlitedb.c 
b/addressbook/libedata-book/e-book-backend-sqlitedb.c
index 38e062b..3c1b50a 100644
--- a/addressbook/libedata-book/e-book-backend-sqlitedb.c
+++ b/addressbook/libedata-book/e-book-backend-sqlitedb.c
@@ -5227,7 +5227,17 @@ upgrade_contacts_table (EBookBackendSqliteDB *ebsdb,
 
        for (l = vcard_data; success && l; l = l->next) {
                EbSdbSearchData *const s_data = l->data;
-               EContact *contact = e_contact_new_from_vcard_with_uid (s_data->vcard, s_data->uid);
+               EContact *contact = NULL;
+
+               /* It can be we're opening a light summary which was created without
+                * storing the vcards, such as was used in EDS versions 3.2 to 3.6.
+                *
+                * In this case we just want to skip the contacts we can't load
+                * and leave them as is in the SQLite, they will be added from
+                * the old BDB in the case of a migration anyway.
+                */
+               if (s_data->vcard)
+                       contact = e_contact_new_from_vcard_with_uid (s_data->vcard, s_data->uid);
 
                if (contact == NULL)
                        continue;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]