changeset 16522:0b49b01e9482

Thanks to Bleeter, yahoo will not crash for non-existent buddyicons anymore.
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Fri, 27 Apr 2007 22:44:46 +0000
parents ff7a7fe88049
children abe54db1c93a
files libpurple/protocols/yahoo/yahoo.c libpurple/protocols/yahoo/yahoo_picture.c
diffstat 2 files changed, 9 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/yahoo/yahoo.c	Fri Apr 27 14:37:15 2007 +0000
+++ b/libpurple/protocols/yahoo/yahoo.c	Fri Apr 27 22:44:46 2007 +0000
@@ -345,6 +345,7 @@
 			/* FIXME: Please, if you know this protocol,
 			 * FIXME: fix up the strtol() stuff if possible. */
 			int cksum = strtol(pair->value, NULL, 10);
+			const char *locksum = NULL;
 			PurpleBuddy *b;
 
 			if (!name)
@@ -363,7 +364,8 @@
 				break;
 
 			yahoo_friend_set_buddy_icon_need_request(f, FALSE);
-			if (b && cksum != strtol(purple_buddy_icons_get_checksum_for_user(b), NULL, 10))
+			if (b && (locksum = purple_buddy_icons_get_checksum_for_user(b)) != NULL &&
+					cksum != strtol(locksum, NULL, 10))
 				yahoo_send_picture_request(gc, name);
 
 			break;
--- a/libpurple/protocols/yahoo/yahoo_picture.c	Fri Apr 27 14:37:15 2007 +0000
+++ b/libpurple/protocols/yahoo/yahoo_picture.c	Fri Apr 27 22:44:46 2007 +0000
@@ -115,9 +115,11 @@
 		PurpleUtilFetchUrlData *url_data;
 		struct yahoo_fetch_picture_data *data;
 		PurpleBuddy *b = purple_find_buddy(gc->account, who);
+		const char *locksum = NULL;
 
 		/* FIXME: Cleanup this strtol() stuff if possible. */
-		if (b && (checksum == strtol(purple_buddy_icons_get_checksum_for_user(b), NULL, 10)))
+		if (b && (locksum = purple_buddy_icons_get_checksum_for_user(b)) != NULL && 
+				(checksum == strtol(locksum, NULL, 10)))
 			return;
 
 		data = g_new0(struct yahoo_fetch_picture_data, 1);
@@ -200,9 +202,11 @@
 
 	if (who) {
 		PurpleBuddy *b = purple_find_buddy(gc->account, who);
+		const char *locksum = NULL;
 
 		/* FIXME: Cleanup this strtol() stuff if possible. */
-		if (b && (checksum != strtol(purple_buddy_icons_get_checksum_for_user(b), NULL, 10)))
+		if (b && (locksum = purple_buddy_icons_get_checksum_for_user(b)) != NULL && 
+				(checksum != strtol(locksum, NULL, 10)))
 			yahoo_send_picture_request(gc, who);
 	}
 }