ref: bc59ac285ada835e9f6518aa599512496dc17f16
parent: 58438f39bfd3b4d1fa1a1db94a48382cacb06ad5
author: mkf <mkf@cloud9p.org>
date: Wed Jun 5 15:29:39 EDT 2024
srv5: dont work on a empty list
--- a/srv5.c
+++ b/srv5.c
@@ -572,7 +572,7 @@
side = strtok(nil, " ");
opts = strtok(nil, " ");
- dprint("newclient(%d): nick: %s, side: %s, game: %s, opts: %s\n", fd, nick, side, game, opts);
+ dprint("newclient(%d): nick: %s, game: %s, side: %s, opts: %s\n", fd, nick, game, side, opts);
if(nick == nil || side == nil || game == nil)
return nil;
@@ -598,8 +598,12 @@
void
makematch(Client *c)
{
- Client *head = clients.l->data;
+ Client *head;
+ if(clients.l == nil)
+ clients.l = llnew();
+
+ head = clients.l->data;
if(head == nil || c->side == head->side)
{
if(c->side == PRandom)