aboutsummaryrefslogtreecommitdiff
path: root/party.c
diff options
context:
space:
mode:
authorrodri <rgl@antares-labs.eu>2023-05-05 22:35:14 +0000
committerrodri <rgl@antares-labs.eu>2023-05-05 22:35:14 +0000
commitd2c0ab7a62b7a2c99c4c491ce55466859429571b (patch)
tree5010f2e6b2e3a87486a7f65dd73f40eee7fec04c /party.c
parentf959555dc653ecf54d75b180fcd018075e652e93 (diff)
downloadmusw-d2c0ab7a62b7a2c99c4c491ce55466859429571b.tar.gz
musw-d2c0ab7a62b7a2c99c4c491ce55466859429571b.tar.bz2
musw-d2c0ab7a62b7a2c99c4c491ce55466859429571b.zip
handle player quits gracefully.
also fixed a bug whereby a player would never be freed if no party was happening, and another one where deleting a player from the player queue would cause a nil pointer deref.
Diffstat (limited to 'party.c')
-rw-r--r--party.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/party.c b/party.c
index 1360875..be0f4ed 100644
--- a/party.c
+++ b/party.c
@@ -117,7 +117,7 @@ playerq_del(Playerq *pq, Player *p)
return;
}
- for(np = pq->head; np->next != nil; np = np->next)
+ for(np = pq->head; np != nil && np->next != nil; np = np->next)
if(np->next == p){
np->next = np->next->next;
p->next = nil;