cpw.darkrain42.xmpp.avatars: 16f1dd6e: I had the distinct pleasure of throwing ...

paul at darkrain42.org paul at darkrain42.org
Fri Feb 13 23:00:39 EST 2009


-----------------------------------------------------------------
Revision: 16f1dd6ecf47976e09b61d1c1c7c71385c474e6a
Ancestor: 85379645d26b351fbf46875690a7df158166a167
Author: paul at darkrain42.org
Date: 2009-02-14T01:18:25
Branch: im.pidgin.cpw.darkrain42.xmpp.avatars
URL: http://d.pidgin.im/viewmtn/revision/info/16f1dd6ecf47976e09b61d1c1c7c71385c474e6a

Modified files:
        libpurple/protocols/jabber/useravatar.c

ChangeLog: 

I had the distinct pleasure of throwing invalid garbage at this code; it
generated many errors like
	g_log: xmlnode_get_child_with_namespace: assertion `parent != NULL' failed

Instead, let's handle it nicely...

-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/useravatar.c	c517d325b91e73337cb63a2d6f99a1d273b77cfe
+++ libpurple/protocols/jabber/useravatar.c	0e445024d8cadc3a2acd240ef1df3f4a0b477e67
@@ -236,6 +236,9 @@ do_got_own_avatar_cb(JabberStream *js, c
 		server_hash = xmlnode_get_attrib(info, "id");
 	}
 
+	if (!metadata)
+		return;
+
 	ns = xmlnode_get_namespace(metadata);
 	if (!ns)
 		return;
@@ -338,8 +341,13 @@ update_buddy_metadata(JabberStream *js, 
 	if(!buddy)
 		return;
 
-	checksum = purple_buddy_icons_get_checksum_for_user(buddy);
+	if (!items)
+		return;
+
 	item = xmlnode_get_child(items,"item");
+	if (!item)
+		return;
+
 	metadata = xmlnode_get_child(item, "metadata");
 	if(!metadata)
 		return;
@@ -350,6 +358,8 @@ update_buddy_metadata(JabberStream *js, 
 	            strcmp(ns, NS_AVATAR_1_1_METADATA)))
 		return;
 
+	checksum = purple_buddy_icons_get_checksum_for_user(buddy);
+
 	/* check if we have received a stop */
 	if(xmlnode_get_child(metadata, "stop")) {
 		purple_buddy_icons_set_for_user(purple_connection_get_account(js->gc), from, NULL, 0, NULL);


More information about the Commits mailing list