changeset 25830:b3dbc9e8b6ef

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...
author Paul Aurich <paul@darkrain42.org>
date Sat, 14 Feb 2009 01:18:25 +0000
parents ab07969d298f
children 0fa91206cf5a
files libpurple/protocols/jabber/useravatar.c
diffstat 1 files changed, 11 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/jabber/useravatar.c	Thu Feb 05 01:00:17 2009 +0000
+++ b/libpurple/protocols/jabber/useravatar.c	Sat Feb 14 01:18:25 2009 +0000
@@ -236,6 +236,9 @@
 		server_hash = xmlnode_get_attrib(info, "id");
 	}
 
+	if (!metadata)
+		return;
+
 	ns = xmlnode_get_namespace(metadata);
 	if (!ns)
 		return;
@@ -338,8 +341,13 @@
 	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 @@
 	            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);