[evolution-patches] patch for #72044 (exchange connector)



This happens when one imports a contact with photo but no note. 

Siva
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution-exchange/ChangeLog,v
retrieving revision 1.285
diff -u -p -r1.285 ChangeLog
--- ChangeLog	8 Mar 2005 10:29:42 -0000	1.285
+++ ChangeLog	9 Mar 2005 03:42:35 -0000
@@ -1,3 +1,11 @@
+2005-03-09 Sivaiah Nallagatla <snallagatla novell com>
+
+	* addresbook/e-book-backend-exchange.c 
+	(build_message) : make sure note is non NULL
+	before processing. Basically added robustness against 
+	ote being NULL.
+	Fixes #72044
+	 
 2005-03-07 Sivaiah Nallagatla <snallagatla novell com>
 
 	* calendar/e-cal-backend-exchange.c (set_mode) :
Index: addressbook/e-book-backend-exchange.c
===================================================================
RCS file: /cvs/gnome/evolution-exchange/addressbook/e-book-backend-exchange.c,v
retrieving revision 1.21
diff -u -p -r1.21 e-book-backend-exchange.c
--- addressbook/e-book-backend-exchange.c	25 Feb 2005 08:40:29 -0000	1.21
+++ addressbook/e-book-backend-exchange.c	9 Mar 2005 03:42:36 -0000
@@ -1136,24 +1136,28 @@ build_message (const char *from_name, co
 	camel_object_unref (from);
 
 	/* Create the body */
-	stream = camel_stream_mem_new_with_buffer (note, strlen (note));
-	wrapper = camel_data_wrapper_new ();
-	camel_data_wrapper_construct_from_stream (wrapper, stream);
-	camel_object_unref (stream);
-
-	type = camel_content_type_new ("text", "plain");
-	camel_content_type_set_param (type, "charset", "UTF-8");
-	camel_data_wrapper_set_mime_type_field (wrapper, type);
-	camel_content_type_unref (type);
-
-	if (photo)
+	if (note) {
+		stream = camel_stream_mem_new_with_buffer (note, strlen (note));
+		wrapper = camel_data_wrapper_new ();
+		camel_data_wrapper_construct_from_stream (wrapper, stream);
+		camel_object_unref (stream);
+		
+		type = camel_content_type_new ("text", "plain");
+		camel_content_type_set_param (type, "charset", "UTF-8");
+		camel_data_wrapper_set_mime_type_field (wrapper, type);
+		camel_content_type_unref (type);
+	}
+	
+	if (note && photo)
 		text_part = camel_mime_part_new ();
-	else
+	else if (note)
 		text_part = CAMEL_MIME_PART (msg);
-
-	camel_medium_set_content_object (CAMEL_MEDIUM (text_part), wrapper);
-	camel_mime_part_set_encoding (text_part, CAMEL_TRANSFER_ENCODING_8BIT);
-
+	else 
+		text_part = NULL;
+	if (text_part) {
+		camel_medium_set_content_object (CAMEL_MEDIUM (text_part), wrapper);
+		camel_mime_part_set_encoding (text_part, CAMEL_TRANSFER_ENCODING_8BIT);
+	}
 	if (photo) {
 		CamelMultipart *multipart;
 		GByteArray *photo_ba;
@@ -1203,9 +1207,10 @@ build_message (const char *from_name, co
 		/* Build the multipart */
 		multipart = camel_multipart_new ();
 		camel_multipart_set_boundary (multipart, NULL);
-
-		camel_multipart_add_part (multipart, text_part);
-		camel_object_unref (text_part);
+		if (text_part) {
+			camel_multipart_add_part (multipart, text_part);
+			camel_object_unref (text_part);
+		}
 		camel_multipart_add_part (multipart, photo_part);
 		camel_object_unref (photo_part);
 


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