pidgin: 4be2df4f: There's no need to check type twice here...

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


-----------------------------------------------------------------
Revision: 4be2df4f72bd8a55cdae7f2554b73342a497c92f
Ancestor: bbd0bbedd3778483d63f47092fced0d34ab639e5
Author: qulogic at pidgin.im
Date: 2009-12-31T04:13:55
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/4be2df4f72bd8a55cdae7f2554b73342a497c92f

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

ChangeLog: 

There's no need to check type twice here. Also, g_return_if_reached is not
correct since img==NULL is caused by invalid network input and not some
programmer error.

-------------- next part --------------
============================================================
--- libpurple/protocols/msn/slp.c	6d32ce180e8f16b3c28824dc524ea95eb9e6fe34
+++ libpurple/protocols/msn/slp.c	2efcf5cc003445877b7a6b2157702832c55cc5dd
@@ -293,7 +293,7 @@ got_sessionreq(MsnSlpCall *slpcall, cons
 		MsnSlpMessage *slpmsg;
 		MsnObject *obj;
 		char *msnobj_data;
-		PurpleStoredImage *img;
+		PurpleStoredImage *img = NULL;
 		int type;
 
 		/* Send Ok */
@@ -312,20 +312,13 @@ got_sessionreq(MsnSlpCall *slpcall, cons
 		type = msn_object_get_type(obj);
 		g_free(msnobj_data);
 
-		if ((type != MSN_OBJECT_USERTILE) && (type != MSN_OBJECT_EMOTICON))
-		{
-			purple_debug_error("msn", "Wrong object?\n");
-			msn_object_destroy(obj);
-			g_return_if_reached();
-		}
-
 		if (type == MSN_OBJECT_EMOTICON) {
 			char *path;
 			path = g_build_filename(purple_smileys_get_storing_dir(),
 					obj->location, NULL);
 			img = purple_imgstore_new_from_file(path);
 			g_free(path);
-		} else {
+		} else if (type == MSN_OBJECT_USERTILE) {
 			img = msn_object_get_image(obj);
 			if (img)
 				purple_imgstore_ref(img);
@@ -335,7 +328,7 @@ got_sessionreq(MsnSlpCall *slpcall, cons
 		if (img == NULL)
 		{
 			purple_debug_error("msn", "Wrong object.\n");
-			g_return_if_reached();
+			return;
 		}
 
 		/* DATA PREP */


More information about the Commits mailing list