[evolution-data-server/migration-tests: 2/2] EBookBackendSqliteDB: Fixed upgrade_contacts() for cases with missing vcards.



commit 84ed67f1d38e90a2274fda8e928903d44bb609cb
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 b639c05..7792962 100644
--- a/addressbook/libedata-book/e-book-backend-sqlitedb.c
+++ b/addressbook/libedata-book/e-book-backend-sqlitedb.c
@@ -4771,7 +4771,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]