Make /skip work properly

This commit is contained in:
j3s 2020-12-01 23:10:24 -06:00 committed by Eyal Sawady
parent 4aeebd4f53
commit f9cf6faa70
No known key found for this signature in database
GPG Key ID: 604D3459E53A9952
1 changed files with 3 additions and 2 deletions

5
main.c
View File

@ -681,8 +681,9 @@ discussion(size_t pid, char *input)
}
}
if(vote < -1 || vote > NUM_PLAYERS-1 || players[vote].fd == -1
|| players[vote].stage != PLAYER_STAGE_DISCUSS) {
if (vote != -1 && (vote < -1 || vote > NUM_PLAYERS-1
|| players[vote].fd == -1
|| players[vote].stage != PLAYER_STAGE_DISCUSS)) {
snprintf(buf, sizeof(buf), "Invalid vote, no such player\n");
write(players[pid].fd, buf, strlen(buf));
return;