Fix a crash when we want to remove a user that is not in the switchboard. soc.2010.msn-tlc

Sat, 18 Sep 2010 20:56:11 +0000

author
Jorge Villaseñor <masca@cpw.pidgin.im>
date
Sat, 18 Sep 2010 20:56:11 +0000
branch
soc.2010.msn-tlc
changeset 31077
f957ef5f187d
parent 31076
dcc26c5e9d7e
child 31078
4743474637f1

Fix a crash when we want to remove a user that is not in the switchboard.

libpurple/protocols/msn/switchboard.c file | annotate | diff | comparison | revisions
--- a/libpurple/protocols/msn/switchboard.c	Wed Sep 15 17:34:21 2010 +0000
+++ b/libpurple/protocols/msn/switchboard.c	Sat Sep 18 20:56:11 2010 +0000
@@ -658,7 +658,10 @@
 		purple_conv_chat_remove_user(PURPLE_CONV_CHAT(swboard->conv), user, NULL);
 
 		passport = g_list_find_custom(swboard->users, user, (GCompareFunc)strcmp);
-		g_free(passport->data);
+		if (passport)
+			g_free(passport->data);
+		else
+			purple_debug_warning("msn", "Can't find user %s in the switchboard\n", user);
 		swboard->users = g_list_delete_link(swboard->users, passport);
 		swboard->current_users--;
 		if (swboard->current_users == 0)

mercurial