From f2f5ea5f7b93cec959226292e528962514c03a81 Mon Sep 17 00:00:00 2001 From: fatbob313 Date: Thu, 26 Nov 2009 20:17:13 +0000 Subject: [PATCH] Corrected a bug that causes segfaults if UDP packets are received when no client connected. Specifically, this happens when a 1.2.x client connects. --- src/client.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/client.c b/src/client.c index 1994364..7463361 100644 --- a/src/client.c +++ b/src/client.c @@ -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) -- 2.30.2