about summary refs log tree commit diff homepage
diff options
context:
space:
mode:
-rwxr-xr-xserver.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/server.c b/server.c
index 64e4e18..2fcdff7 100755
--- a/server.c
+++ b/server.c
@@ -123,16 +123,15 @@ static bool clientSend(const struct Client *client, const struct ServerMessage *
 }
 
 static void clientCast(const struct Client *origin, const struct ServerMessage *msg) {
+retry:
     for (struct Client *client = clientHead; client; client = client->next) {
         if (client == origin) continue;
         if (client->tileX != origin->tileX) continue;
         if (client->tileY != origin->tileY) continue;
 
         if (!clientSend(client, msg)) {
-            struct Client *dead = client;
-            client = client->next;
-            clientRemove(dead);
-            if (!client) break;
+            clientRemove(client);
+            goto retry;
         }
     }
 }