From b6b8dc64442a51921ac8067af9a69b007c2fb876 Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Tue, 18 Feb 2003 20:26:22 +0000 Subject: fixes to my last commit svn path=/trunk/; revision=19933 --- mail/mail-config.c | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) (limited to 'mail') diff --git a/mail/mail-config.c b/mail/mail-config.c index 418959f2df..02a72ea672 100644 --- a/mail/mail-config.c +++ b/mail/mail-config.c @@ -606,29 +606,28 @@ mail_config_get_default_account (void) uid = gconf_client_get_string (config->gconf, "/apps/evolution/mail/default_account", NULL); iter = e_list_get_iterator ((EList *) config->accounts); - - while (e_iterator_is_valid (iter)) { - account = (EAccount *) e_iterator_get (iter); - - if (!strcmp (account->uid, uid)) { - g_object_unref (iter); - g_free (uid); + if (uid != NULL) { + while (e_iterator_is_valid (iter)) { + account = (EAccount *) e_iterator_get (iter); - return account; + if (!strcmp (account->uid, uid)) { + g_object_unref (iter); + g_free (uid); + + return account; + } + + e_iterator_next (iter); } - e_iterator_next (iter); - } - - if (account == NULL) { - /* Looks like we have no default, so make the first account - the default */ - e_iterator_reset (iter); - account = (EAccount *) e_iterator_get (iter); - - gconf_client_set_string (config->gconf, "/apps/evolution/mail/default_account", account->uid, NULL); + g_free (uid); } + /* Looks like we have no default, so make the first account + the default */ + e_iterator_reset (iter); + account = (EAccount *) e_iterator_get (iter); + gconf_client_set_string (config->gconf, "/apps/evolution/mail/default_account", account->uid, NULL); g_object_unref (iter); return account; -- cgit v1.2.3