diff libpurple/protocols/msn/msn.c @ 23616:6659ba7b3941

Fix a crash when the user isn't in your list.
author Daniel Atallah <daniel.atallah@gmail.com>
date Tue, 29 Jul 2008 18:55:03 +0000
parents 7f4b697c6947
children 7a71457cdd32
line wrap: on
line diff
--- a/libpurple/protocols/msn/msn.c	Tue Jul 29 18:53:00 2008 +0000
+++ b/libpurple/protocols/msn/msn.c	Tue Jul 29 18:55:03 2008 +0000
@@ -583,9 +583,7 @@
 msn_can_receive_file(PurpleConnection *gc, const char *who)
 {
 	PurpleAccount *account;
-	char *normal;
-	MsnSession *session;
-	MsnUser *user;
+	gchar *normal;
 	gboolean ret;
 
 	account = purple_connection_get_account(gc);
@@ -595,9 +593,10 @@
 	g_free(normal);
 
 	if (ret) {
-		session = gc->proto_data;
-		user = msn_userlist_find_user(session->userlist, who);
-		ret = (user->clientid & MSN_CLIENT_CAP_WEBMSGR) == 0;
+		MsnSession *session = gc->proto_data;
+		MsnUser *user = msn_userlist_find_user(session->userlist, who);
+		if (user)
+			ret = (user->clientid & MSN_CLIENT_CAP_WEBMSGR) == 0;
 		/* Include these too: MSN_CLIENT_CAP_MSNMOBILE|MSN_CLIENT_CAP_MSNDIRECT ? */
 	}
 
@@ -1352,6 +1351,7 @@
 
 	if (group_id >= 0)
 	{
+		/* This is wrong... user->group_ids contains g_strdup()'d data now */
 		user->group_ids = g_list_append(user->group_ids,
 										GINT_TO_POINTER(group_id));
 	}