changeset 8657:4a1e87c50d6f

[gaim-migrate @ 9409] Patch by shx to make the e-mail notification code in MSN a bit more cautious, and hopefully prevent some of the crashes that people have experienced. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Wed, 14 Apr 2004 04:03:14 +0000
parents a47f038ecf9a
children 4133c85d76f7
files src/protocols/msn/notification.c
diffstat 1 files changed, 18 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/protocols/msn/notification.c	Wed Apr 14 03:13:08 2004 +0000
+++ b/src/protocols/msn/notification.c	Wed Apr 14 04:03:14 2004 +0000
@@ -1705,7 +1705,9 @@
 	MsnSession *session = servconn->session;
 	GaimConnection *gc = session->account->gc;
 	GHashTable *table;
-	char *from, *subject;
+	char *from, *subject, *tmp;
+
+	from = subject = NULL;
 
 	if (strcmp(msg->passport, "Hotmail")) {
 		/* This isn't an official message. */
@@ -1725,14 +1727,23 @@
 
 	table = msn_message_get_hashtable_from_body(msg);
 
-	from    = gaim_mime_decode_field(g_hash_table_lookup(table, "From"));
-	subject = gaim_mime_decode_field(g_hash_table_lookup(table, "Subject"));
+	tmp = g_hash_table_lookup(table, "From");
+	if (tmp != NULL)
+		from = gaim_mime_decode_field(tmp);
+
+	tmp = g_hash_table_lookup(table, "Subject");
+	if (tmp != NULL)
+		subject = gaim_mime_decode_field(tmp);
 
-	gaim_notify_email(gc, subject, from, msn_user_get_passport(session->user),
-					  session->passport_info.file, NULL, NULL);
+	if (from != NULL && subject != NULL)	
+		gaim_notify_email(gc, subject, from, msn_user_get_passport(session->user),
+						session->passport_info.file, NULL, NULL);
 
-	g_free(from);
-	g_free(subject);
+	if (from != NULL)
+		g_free(from);
+
+	if (subject != NULL)
+		g_free(subject);
 
 	g_hash_table_destroy(table);