Corrected a bug that causes segfaults if UDP packets are received when no client...
authorfatbob313 <martin@fatbob.nu>
Thu, 26 Nov 2009 20:17:13 +0000 (20:17 +0000)
committerfatbob313 <martin@fatbob.nu>
Thu, 26 Nov 2009 20:17:13 +0000 (20:17 +0000)
src/client.c

index 1994364c18153e4b708b567776888af229034aa4..74633613b744401636c10eee2c7a3b535d5f5bac 100644 (file)
@@ -377,8 +377,11 @@ int Client_send_message(client_t *client, message_t *msg)
 client_t *Client_iterate(client_t **client_itr)
 {
        client_t *c = *client_itr;
+
+       if (list_empty(&clients))
+               return NULL;
        
-       if (c == NULL && !list_empty(&clients)) {
+       if (c == NULL) {
                c = list_get_entry(list_get_first(&clients), client_t, node);
        } else {
                if (list_get_next(&c->node) == &clients)