Mercurial > pidgin
diff src/protocols/jabber/xmlnode.c @ 7075:4e5654931401
[gaim-migrate @ 7640]
this is how this function is supposed to behave
committer: Tailor Script <tailor@pidgin.im>
author | Nathan Walp <nwalp@pidgin.im> |
---|---|
date | Tue, 30 Sep 2003 17:14:14 +0000 |
parents | 67c4e9d39242 |
children | ec7c5aead3d7 |
line wrap: on
line diff
--- a/src/protocols/jabber/xmlnode.c Tue Sep 30 16:36:00 2003 +0000 +++ b/src/protocols/jabber/xmlnode.c Tue Sep 30 17:14:14 2003 +0000 @@ -210,21 +210,25 @@ char * xmlnode_get_data(xmlnode *node) { - GString *str; - char *ret; + GString *str = NULL; + char *ret = NULL; xmlnode *c; g_return_val_if_fail(node != NULL, NULL); - str = g_string_new(""); for(c = node->child; c; c = c->next) { - if(c->type == NODE_TYPE_DATA) + if(c->type == NODE_TYPE_DATA) { + if(!str) + str = g_string_new(""); str = g_string_append_len(str, c->data, c->data_sz); + } } - ret = str->str; - g_string_free(str, FALSE); + if(str) { + ret = str->str; + g_string_free(str, FALSE); + } return ret; }