From: Sergio Villar Senin Date: Tue, 3 Jun 2008 15:40:10 +0000 (+0000) Subject: * Fixes NB#86176, do not remove own address when it's the only one and "reply to... X-Git-Tag: git_migration_finished~1327 X-Git-Url: http://git.maemo.org/git/?p=modest;a=commitdiff_plain;h=e9c67b1991508f5be50928eac2d32ff52b50bd5e * Fixes NB#86176, do not remove own address when it's the only one and "reply to all" pmo-trunk-r4601 --- diff --git a/src/modest-text-utils.c b/src/modest-text-utils.c index 0b8927e..012ac59 100644 --- a/src/modest-text-utils.c +++ b/src/modest-text-utils.c @@ -356,23 +356,27 @@ modest_text_utils_remove_duplicate_addresses (const gchar *address_list) { GSList *addresses, *cursor; GHashTable *table; - gchar *new_list; + gchar *new_list = NULL; g_return_val_if_fail (address_list, NULL); table = g_hash_table_new (g_str_hash, g_str_equal); addresses = modest_text_utils_split_addresses_list (address_list); - new_list = g_strdup(""); cursor = addresses; while (cursor) { const gchar* address = (const gchar*)cursor->data; /* ignore the address if already seen */ if (g_hash_table_lookup (table, address) == 0) { - - gchar *tmp = g_strjoin (",", new_list, address, NULL); - g_free (new_list); + gchar *tmp; + + if (!new_list) { + tmp = g_strdup (address); + } else { + tmp = g_strjoin (",", new_list, address, NULL); + g_free (new_list); + } new_list = tmp; g_hash_table_insert (table, (gchar*)address, GINT_TO_POINTER(1));