[balsa] Address book editor: do not crash
- From: Peter Bloomfield <peterb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [balsa] Address book editor: do not crash
- Date: Wed, 27 Nov 2019 01:24:09 +0000 (UTC)
commit 5eb0835f13b9cbba4759b748210d2a753ef63ea0
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date: Tue Nov 26 20:21:57 2019 -0500
Address book editor: do not crash
if no address books are available for editing.
* src/ab-main.c (bab_set_intial_address_book), (main): check for
NULL address book list.
ChangeLog | 8 ++++++++
src/ab-main.c | 26 ++++++++++++++++++--------
2 files changed, 26 insertions(+), 8 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index e8c61621c..ac92b52bc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2019-11-26 Peter Bloomfield <pbloomfield bellsouth net>
+
+ Address book editor: do not crash if no address books are
+ available for editing.
+
+ * src/ab-main.c (bab_set_intial_address_book), (main): check for
+ NULL address book list.
+
2019-11-18 Peter Bloomfield <pbloomfield bellsouth net>
libbalsa_message_body_get_mime_type() is guaranteed to return a
diff --git a/src/ab-main.c b/src/ab-main.c
index 0588acaa3..963cb6ce2 100644
--- a/src/ab-main.c
+++ b/src/ab-main.c
@@ -1021,11 +1021,16 @@ static void
bab_set_intial_address_book(LibBalsaAddressBook * ab,
GtkWidget * window)
{
- GAction *action;
-
- action =
- g_action_map_lookup_action(G_ACTION_MAP(window), "address-book");
- g_action_change_state(action, g_variant_new_string(libbalsa_address_book_get_name(ab)));
+ if (ab != NULL) {
+ GAction *action;
+
+ action =
+ g_action_map_lookup_action(G_ACTION_MAP(window),
+ "address-book");
+ g_action_change_state(action,
+ g_variant_new_string
+ (libbalsa_address_book_get_name(ab)));
+ }
}
GtkDialogFlags
@@ -1120,9 +1125,14 @@ main(int argc, char *argv[])
libbalsa_conf_pop_group();
libbalsa_conf_foreach_group(ADDRESS_BOOK_SECTION_PREFIX,
bab_config_init, NULL);
- ab = contacts_app.default_address_book ?
- contacts_app.default_address_book :
- contacts_app.address_book_list->data;
+ if (contacts_app.address_book_list == NULL) {
+ /* No address books found--why did we launch the editor? */
+ ab = NULL;
+ } else {
+ ab = contacts_app.default_address_book ?
+ contacts_app.default_address_book :
+ contacts_app.address_book_list->data;
+ }
ab_window = bab_window_new(application);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]