pidgin: 8dddccdd: Make sure we don't crash if we can't fin...

qulogic at pidgin.im qulogic at pidgin.im
Mon Mar 14 00:37:53 EDT 2011


----------------------------------------------------------------------
Revision: 8dddccddfcea9672daf98feaf43ac814f322448b
Parent:   17b575126cb421d1171a9ec4354e8584e0d1934c
Author:   qulogic at pidgin.im
Date:     03/13/11 20:28:35
Branch:   im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/8dddccddfcea9672daf98feaf43ac814f322448b

Changelog: 

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.

Changes against parent 17b575126cb421d1171a9ec4354e8584e0d1934c

  patched  libpurple/protocols/msn/notification.c

-------------- next part --------------
============================================================
--- libpurple/protocols/msn/notification.c	569f5e865a9ee55379da93e776a9e9a0e288c585
+++ libpurple/protocols/msn/notification.c	c9d1203097e0dbdcf82b99effd0985ab7ccc0d55
@@ -1203,22 +1203,23 @@ ipg_cmd_post(MsnCmdProc *cmdproc, MsnCom
 			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 (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);
+					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));
+						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;
+						g_free(body_str);
+						g_free(body_enc);
+						msn_message_unref(msg);
+						trans->data = NULL;
+					}
 				}
 			}
 		}


More information about the Commits mailing list