[evolution/gnome-3-10] pine-importer: Fix a crash when importing with no existing address books



commit 6a576d7441f64c08df0b144346d844ea46364a52
Author: Philip Withnall <philip withnall collabora co uk>
Date:   Fri Nov 29 11:20:32 2013 +0000

    pine-importer: Fix a crash when importing with no existing address books
    
    This is a theoretical crash (not actually reproduced), caused by the
    client variable being NULL if no address books exist. Instead of
    crashing, gracefully exit with an error.
    
    Found by scan-build.
    
    https://bugzilla.gnome.org/719540
    
    (cherry picked from commit 7cb2ed6c67b09ca0f2ece3ca4d56b60e97b5ac6f)

 mail/importers/pine-importer.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
---
diff --git a/mail/importers/pine-importer.c b/mail/importers/pine-importer.c
index c37d3bd..b225d67 100644
--- a/mail/importers/pine-importer.c
+++ b/mail/importers/pine-importer.c
@@ -202,6 +202,11 @@ import_contacts (void)
 
                source = E_SOURCE (list->data);
                client = e_book_client_connect_sync (source, NULL, &error);
+       } else {
+               /* No address books exist. */
+               g_warning ("%s: No address books exist.", G_STRFUNC);
+               fclose (fp);
+               return;
        }
 
        g_list_free_full (list, (GDestroyNotify) g_object_unref);


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