pidgin: 3d02401c: Using 'if (img==NULL) return;' fails to ...

qulogic at pidgin.im qulogic at pidgin.im
Fri Jan 1 03:47:04 EST 2010


-----------------------------------------------------------------
Revision: 3d02401cf232459fc80c0837d31e05fae7ae5467
Ancestor: 4be2df4f72bd8a55cdae7f2554b73342a497c92f
Author: qulogic at pidgin.im
Date: 2009-12-31T04:45:35
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/3d02401cf232459fc80c0837d31e05fae7ae5467

Modified files:
        libpurple/protocols/msn/slp.c

ChangeLog: 

Using 'if (img==NULL) return;' fails to clean up properly, so invert the
logic of that section.

-------------- next part --------------
============================================================
--- libpurple/protocols/msn/slp.c	2efcf5cc003445877b7a6b2157702832c55cc5dd
+++ libpurple/protocols/msn/slp.c	b9b135713b7e49a4c7a2c5e4f2209d5a7b4cf1d9
@@ -325,30 +325,29 @@ got_sessionreq(MsnSlpCall *slpcall, cons
 		}
 		msn_object_destroy(obj);
 
-		if (img == NULL)
-		{
-			purple_debug_error("msn", "Wrong object.\n");
-			return;
-		}
+		if (img != NULL) {
+			/* DATA PREP */
+			slpmsg = msn_slpmsg_new(slplink);
+			slpmsg->slpcall = slpcall;
+			slpmsg->session_id = slpcall->session_id;
+			msn_slpmsg_set_body(slpmsg, NULL, 4);
+			slpmsg->info = "SLP DATA PREP";
+			msn_slplink_queue_slpmsg(slplink, slpmsg);
 
-		/* DATA PREP */
-		slpmsg = msn_slpmsg_new(slplink);
-		slpmsg->slpcall = slpcall;
-		slpmsg->session_id = slpcall->session_id;
-		msn_slpmsg_set_body(slpmsg, NULL, 4);
-		slpmsg->info = "SLP DATA PREP";
-		msn_slplink_queue_slpmsg(slplink, slpmsg);
+			/* DATA */
+			slpmsg = msn_slpmsg_new(slplink);
+			slpmsg->slpcall = slpcall;
+			slpmsg->flags = 0x20;
+			slpmsg->info = "SLP DATA";
+			msn_slpmsg_set_image(slpmsg, img);
+			msn_slplink_queue_slpmsg(slplink, slpmsg);
+			purple_imgstore_unref(img);
 
-		/* DATA */
-		slpmsg = msn_slpmsg_new(slplink);
-		slpmsg->slpcall = slpcall;
-		slpmsg->flags = 0x20;
-		slpmsg->info = "SLP DATA";
-		msn_slpmsg_set_image(slpmsg, img);
-		msn_slplink_queue_slpmsg(slplink, slpmsg);
-		purple_imgstore_unref(img);
+			accepted = TRUE;
 
-		accepted = TRUE;
+		} else {
+			purple_debug_error("msn", "Wrong object.\n");
+		}
 	}
 
 	else if (!strcmp(euf_guid, MSN_FT_GUID))


More information about the Commits mailing list