From d52040f42b0964b6f56f639bc6bc99c6f1a9906f Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Thu, 7 Jan 2010 18:33:59 +0100 Subject: Bug #606316 - Mail with an attachment in a Junk folder crashes Evo --- mail/em-format-html-display.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) (limited to 'mail/em-format-html-display.c') diff --git a/mail/em-format-html-display.c b/mail/em-format-html-display.c index 9228aec472..ccbf531e52 100644 --- a/mail/em-format-html-display.c +++ b/mail/em-format-html-display.c @@ -801,20 +801,23 @@ efhd_attachment_button(EMFormatHTML *efh, GtkHTMLEmbedded *eb, EMFormatHTMLPObje gpointer parent; EMFormat *emf = (EMFormat *) efh; CamelMessageInfo *mi = NULL; - CamelMessageContentInfo *ci = NULL; - GFileInfo *fileinfo; - guint32 size; + guint32 size = 0; /* FIXME: handle default shown case */ d(printf("adding attachment button/content\n")); mi = camel_folder_summary_uid (emf->folder->summary, emf->uid); - ci = camel_folder_summary_guess_content_info (mi, ((CamelDataWrapper *)pobject->part)->mime_type); - if (ci) { - size = ci->size; - /* what if its not encoded in base64 ? is it a case to consider? */ - if (ci->encoding && !g_ascii_strcasecmp (ci->encoding, "base64")) - size = size/1.37; + if (mi) { + const CamelMessageContentInfo *ci; + + ci = camel_folder_summary_guess_content_info (mi, camel_mime_part_get_content_type (pobject->part)); + if (ci) { + size = ci->size; + /* what if its not encoded in base64 ? is it a case to consider? */ + if (ci->encoding && !g_ascii_strcasecmp (ci->encoding, "base64")) + size = size/1.37; + } + camel_message_info_free (mi); } info = (struct _attach_puri *)em_format_find_puri((EMFormat *)efh, pobject->classid); @@ -843,6 +846,8 @@ efhd_attachment_button(EMFormatHTML *efh, GtkHTMLEmbedded *eb, EMFormatHTMLPObje info->attachment, (GAsyncReadyCallback) e_attachment_load_handle_error, parent); if (size != 0) { + GFileInfo *fileinfo; + fileinfo = e_attachment_get_file_info (info->attachment); g_file_info_set_size (fileinfo, size); e_attachment_set_file_info (info->attachment, fileinfo); -- cgit v1.2.3