about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--jabber.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/jabber.c b/jabber.c
index a0774c31..d55b56fd 100644
--- a/jabber.c
+++ b/jabber.c
@@ -193,10 +193,11 @@ static int _roster_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanz
         query = xmpp_stanza_get_child_by_name(stanza, "query");
         cons_highlight_show("Roster:");
 
-        for (item = xmpp_stanza_get_children(query); item; 
-                item = xmpp_stanza_get_next(item)) {
+        item = xmpp_stanza_get_children(query);
+        while (item != NULL) {
             name = xmpp_stanza_get_attribute(item, "name");
             jid = xmpp_stanza_get_attribute(item, "jid");
+
             if (name != NULL) {
                 char line[2 + strlen(name) + 2 + strlen(jid) + 1 + 1];
                 sprintf(line, "  %s (%s)", name, jid);
@@ -207,6 +208,8 @@ static int _roster_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanz
                 sprintf(line, "  %s", jid);
                 cons_show(line);
             }
+        
+            item = xmpp_stanza_get_next(item);
         }
     }