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
This commit is contained in:
Philip Withnall
2013-11-29 11:20:32 +00:00
committed by Matthew Barnes
parent ea219ed51b
commit 7cb2ed6c67

View File

@ -198,6 +198,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);