[evolution/gnome-2-32] Bug #629799 - Crash importing a mail with an ics attachment



commit 12fce30094a0dd08266e556f8b6a4922b1ab3fb7
Author: Milan Crha <mcrha redhat com>
Date:   Wed Sep 29 11:33:17 2010 +0200

    Bug #629799 - Crash importing a mail with an ics attachment

 mail/em-format-html-display.c           |   25 ++++++++++++++-----------
 plugins/itip-formatter/itip-formatter.c |   12 +++++++-----
 2 files changed, 21 insertions(+), 16 deletions(-)
---
diff --git a/mail/em-format-html-display.c b/mail/em-format-html-display.c
index b2661b6..04ebb42 100644
--- a/mail/em-format-html-display.c
+++ b/mail/em-format-html-display.c
@@ -781,24 +781,27 @@ efhd_attachment_button(EMFormatHTML *efh, GtkHTMLEmbedded *eb, EMFormatHTMLPObje
 	GtkWidget *widget;
 	gpointer parent;
 	EMFormat *emf = (EMFormat *) efh;
-	CamelMessageInfo *mi = NULL;
 	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);
-	if (mi) {
-		const CamelMessageContentInfo *ci;
+	if (emf->folder && emf->folder->summary && emf->uid) {
+		CamelMessageInfo *mi;
 
-		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;
+		mi = camel_folder_summary_uid (emf->folder->summary, emf->uid);
+		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);
 		}
-		camel_message_info_free (mi);
 	}
 
 	info = (struct _attach_puri *)em_format_find_puri((EMFormat *)efh, pobject->classid);
diff --git a/plugins/itip-formatter/itip-formatter.c b/plugins/itip-formatter/itip-formatter.c
index 5e46cb4..f46debf 100644
--- a/plugins/itip-formatter/itip-formatter.c
+++ b/plugins/itip-formatter/itip-formatter.c
@@ -231,7 +231,7 @@ find_to_address (struct _itip_puri *pitip, icalcomponent *ical_comp, icalparamet
 
 	it = e_list_get_iterator((EList *)pitip->accounts);
 
-	if (!pitip->to_address && pitip->msg) {
+	if (!pitip->to_address && pitip->msg && pitip->folder) {
 		EAccount *account = em_utils_guess_account (pitip->msg, pitip->folder);
 
 		if (account) {
@@ -822,6 +822,8 @@ find_server (struct _itip_puri *pitip, ECalComponent *comp)
 	gchar *uri;
 	ESource *source = NULL, *current_source = NULL;
 
+	g_return_if_fail (pitip->folder != NULL);
+
 	e_cal_component_get_uid (comp, &uid);
 	rid = e_cal_component_get_recurid_as_string (comp);
 
@@ -1973,7 +1975,7 @@ view_response_cb (GtkWidget *widget, ItipViewResponse response, gpointer data)
 	}
 
 	/* FIXME Remove this and handle this at the groupwise mail provider */
-	if (delete_invitation_from_cache) {
+	if (delete_invitation_from_cache && pitip->folder) {
 		CamelFolderChangeInfo *changes = NULL;
 		const gchar *tag = NULL;
 		CamelMessageInfo *mi;
@@ -2025,7 +2027,7 @@ view_response_cb (GtkWidget *widget, ItipViewResponse response, gpointer data)
 		}
 	}
 
-	if (!save_schedules && pitip->delete_message) {
+	if (!save_schedules && pitip->delete_message && pitip->folder) {
 		camel_folder_delete_message (pitip->folder, pitip->uid);
 	}
 
@@ -2096,7 +2098,7 @@ view_response_cb (GtkWidget *widget, ItipViewResponse response, gpointer data)
 		}
 
                 e_cal_component_rescan (comp);
-                if (itip_send_comp (E_CAL_COMPONENT_METHOD_REPLY, comp, pitip->current_ecal, pitip->top_level, NULL, NULL, TRUE, FALSE)) {
+                if (itip_send_comp (E_CAL_COMPONENT_METHOD_REPLY, comp, pitip->current_ecal, pitip->top_level, NULL, NULL, TRUE, FALSE) && pitip->folder) {
 			camel_folder_set_message_flags (pitip->folder, pitip->uid, CAMEL_MESSAGE_ANSWERED, CAMEL_MESSAGE_ANSWERED);
 		}
 
@@ -2132,7 +2134,7 @@ in_proper_folder (CamelFolder *folder)
 	gchar *uri;
 
 	if (!folder)
-		return res;
+		return FALSE;
 
 	uri = mail_tools_folder_to_url (folder);
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]