changeset 31382:7b021b6a09af

Make sure we don't crash if we can't find the transaction for the mobile error. This is highly unlikely though, since errors occur almost immediately after sending.
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Mon, 14 Mar 2011 00:28:35 +0000
parents c78c13eee4e6
children 4560c312907a
files libpurple/protocols/msn/notification.c
diffstat 1 files changed, 15 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/msn/notification.c	Sun Mar 13 23:40:42 2011 +0000
+++ b/libpurple/protocols/msn/notification.c	Mon Mar 14 00:28:35 2011 +0000
@@ -1203,22 +1203,23 @@
 			if ((id = xmlnode_get_attrib(payloadNode, "id")) != NULL) {
 				unsigned int trId = atol(id);
 				MsnTransaction *trans;
-				MsnMessage *msg;
 
 				trans = msn_history_find(cmdproc->history, trId);
-				msg = (MsnMessage *)trans->data;
-
-				if (msg) {
-					char *body_str = msn_message_to_string(msg);
-					char *body_enc = g_markup_escape_text(body_str, -1);
-
-					purple_conversation_write(conv, NULL, body_enc,
-					                          PURPLE_MESSAGE_RAW, time(NULL));
-
-					g_free(body_str);
-					g_free(body_enc);
-					msn_message_unref(msg);
-					trans->data = NULL;
+				if (trans) {
+					MsnMessage *msg = (MsnMessage *)trans->data;
+
+					if (msg) {
+						char *body_str = msn_message_to_string(msg);
+						char *body_enc = g_markup_escape_text(body_str, -1);
+
+						purple_conversation_write(conv, NULL, body_enc,
+					                          	PURPLE_MESSAGE_RAW, time(NULL));
+
+						g_free(body_str);
+						g_free(body_enc);
+						msn_message_unref(msg);
+						trans->data = NULL;
+					}
 				}
 			}
 		}