From a29a03d6580a50975f4a926a671b953cf8005586 Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Mon, 7 Apr 2003 20:21:38 +0000 Subject: For string columns, never return NULL - always return "" if the value is 2003-04-07 Jeffrey Stedfast * message-list.c (ml_tree_value_at): For string columns, never return NULL - always return "" if the value is empty. Fixes bug #40728. svn path=/trunk/; revision=20730 --- mail/ChangeLog | 4 ++++ mail/message-list.c | 28 ++++++++++++++++------------ 2 files changed, 20 insertions(+), 12 deletions(-) (limited to 'mail') diff --git a/mail/ChangeLog b/mail/ChangeLog index 7ef81f7b34..b5ae5e318d 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,5 +1,9 @@ 2003-04-07 Jeffrey Stedfast + * message-list.c (ml_tree_value_at): For string columns, never + return NULL - always return "" if the value is empty. Fixes bug + #40728. + * mail-composer-prefs.c (sig_add_script_cb): Set the "script" data on the GtkEntry to NULL. (sig_add_script_response): If the "script" data on the GtkEntry diff --git a/mail/message-list.c b/mail/message-list.c index bbe2b4fdb5..7e0135749b 100644 --- a/mail/message-list.c +++ b/mail/message-list.c @@ -416,7 +416,7 @@ get_normalised_string (MessageList *message_list, CamelMessageInfo *info, int co normalised = g_utf8_collate_key (string, -1); e_poolv_set (poolv, index, normalised, TRUE); - + return e_poolv_get (poolv, index); } @@ -885,11 +885,11 @@ ml_tree_value_at (ETreeModel *etm, ETreePath path, int col, void *model_data) { MessageList *message_list = model_data; CamelMessageInfo *msg_info; + const char *str; /* retrieve the message information array */ msg_info = e_tree_memory_node_get_data (E_TREE_MEMORY(etm), path); - if (!msg_info) - return NULL; + g_assert (msg_info != NULL); switch (col){ case COL_MESSAGE_STATUS: { @@ -946,25 +946,29 @@ ml_tree_value_at (ETreeModel *etm, ETreePath path, int col, void *model_data) } } case COL_FOLLOWUP_FLAG: - return (void *) camel_tag_get ((CamelTag **) &msg_info->user_tags, "follow-up"); + str = camel_tag_get ((CamelTag **) &msg_info->user_tags, "follow-up"); + return (void *) str ? str : ""; case COL_ATTACHMENT: return GINT_TO_POINTER ((msg_info->flags & CAMEL_MESSAGE_ATTACHMENTS) != 0); case COL_FROM: - return (void *)camel_message_info_from(msg_info); + str = camel_message_info_from (msg_info); + return (void *) str ? str : ""; case COL_FROM_NORM: - return (void *)get_normalised_string (message_list, msg_info, col); + return (void *) get_normalised_string (message_list, msg_info, col); case COL_SUBJECT: - return (void *)camel_message_info_subject(msg_info); + str = camel_message_info_subject (msg_info); + return (void *) str ? str : ""; case COL_SUBJECT_NORM: - return (void *)get_normalised_string (message_list, msg_info, col); + return (void *) get_normalised_string (message_list, msg_info, col); case COL_SENT: return GINT_TO_POINTER (msg_info->date_sent); case COL_RECEIVED: return GINT_TO_POINTER (msg_info->date_received); case COL_TO: - return (void *)camel_message_info_to(msg_info); + str = camel_message_info_to (msg_info); + return (void *) str ? str : ""; case COL_TO_NORM: - return (void *)get_normalised_string (message_list, msg_info, col); + return (void *) get_normalised_string (message_list, msg_info, col); case COL_SIZE: return GINT_TO_POINTER (msg_info->size); case COL_DELETED: @@ -1017,13 +1021,13 @@ ml_tree_value_at (ETreeModel *etm, ETreePath path, int col, void *model_data) case COL_LOCATION: { CamelFolder *folder; char *name; - + if (CAMEL_IS_VEE_FOLDER(message_list->folder)) { folder = camel_vee_folder_get_location((CamelVeeFolder *)message_list->folder, (CamelVeeMessageInfo *)msg_info, NULL); } else { folder = message_list->folder; } - + camel_object_get(folder, NULL, CAMEL_OBJECT_DESCRIPTION, &name, 0); return name; } -- cgit v1.2.3