diff options
author | Paul Aurich <darkrain42@pidgin.im> | 2009-02-14 01:18:25 +0000 |
---|---|---|
committer | Paul Aurich <darkrain42@pidgin.im> | 2009-02-14 01:18:25 +0000 |
commit | 1ddcba8d5b62870d3ebedcf01225c90f5df6e8e6 (patch) | |
tree | 66bea5ad13f5e39fd24539f4bbe37b1ae9cfe698 | |
parent | 2b076108d5e0ad784d0e700ca3a369eef2ff2839 (diff) | |
download | pidgin-1ddcba8d5b62870d3ebedcf01225c90f5df6e8e6.tar.gz |
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...
-rw-r--r-- | libpurple/protocols/jabber/useravatar.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/libpurple/protocols/jabber/useravatar.c b/libpurple/protocols/jabber/useravatar.c index ad8b6992be..eeea312ba0 100644 --- a/libpurple/protocols/jabber/useravatar.c +++ b/libpurple/protocols/jabber/useravatar.c @@ -236,6 +236,9 @@ do_got_own_avatar_cb(JabberStream *js, const char *from, xmlnode *items) 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, const char *from, xmlnode *items) 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, const char *from, xmlnode *items) 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); |