Code review fix: check return value of e_book_add_contact
authorJose Dapena Paz <jdapena@igalia.com>
Tue, 31 Mar 2009 11:56:57 +0000 (11:56 +0000)
committerJose Dapena Paz <jdapena@igalia.com>
Tue, 31 Mar 2009 11:56:57 +0000 (11:56 +0000)
pmo-trunk-r8486

src/hildon2/modest-address-book.c

index 6964ed3..48dc31a 100644 (file)
@@ -445,10 +445,18 @@ commit_contact(EContact * contact, gboolean is_new)
        if (OSSO_ABOOK_IS_CONTACT (contact)) {
                osso_abook_contact_commit(OSSO_ABOOK_CONTACT(contact), is_new, book, NULL);
        } else {
-               if (is_new)
-                       e_book_add_contact (book, contact, NULL);
-               else
-                       e_book_commit_contact (book, contact, NULL);
+               GError *err = NULL;
+               if (is_new) {
+                       if (!e_book_add_contact (book, contact, &err)) {
+                               g_warning ("Failed to add contact: %s", err->message);
+                               g_error_free (err);
+                       }
+               } else {
+                       if (!e_book_commit_contact (book, contact, &err)) {
+                               g_warning ("Failed to commit contact: %s", err->message);
+                               g_error_free (err);
+                       }
+               }
        }
 #endif /* MODEST_ABOOK_API < 2 */
 }