summaryrefslogtreecommitdiff
path: root/server.c
diff options
context:
space:
mode:
authorJohnny Richard <johnny@johnnyrichard.com>2022-04-16 01:54:27 +0200
committerJohnny Richard <johnny@johnnyrichard.com>2022-04-16 01:54:27 +0200
commit02cdc2f8ef501a0fd8294946cce9ee3449853151 (patch)
tree8b411bfdc2f1f541be329c650634d5b7360a9f65 /server.c
parent7dc405e07e861a01aad8f92ca1b69bd58fd63c5d (diff)
server: Accept and ignore empty messages
Diffstat (limited to 'server.c')
-rw-r--r--server.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/server.c b/server.c
index 016eca8..9a72199 100644
--- a/server.c
+++ b/server.c
@@ -226,7 +226,10 @@ server_on_client_msg(server_t *server, client_t *client)
char* msg = strdup(client->msg_buf);
char* token = strtok(msg, " ");
- if (strcmp(token, "USER") == 0) {
+ if (token == NULL) {
+ goto exit;
+
+ } else if (strcmp(token, "USER") == 0) {
token = strtok(NULL, " ");
sprintf(reply, "001 %s :Welcome!\n", client->nick);