aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--FICS/comproc.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/FICS/comproc.c b/FICS/comproc.c
index 4fe252b..a37e60a 100644
--- a/FICS/comproc.c
+++ b/FICS/comproc.c
@@ -1170,6 +1170,10 @@ alpha_cmp(const void *pp1, const void *pp2)
PRIVATE void
sort_players(int players[PARRAY_SIZE], who_cmp_t cmp_func)
{
+ if (p_num <= 0) {
+ warnx("%s: p_num <= 0", __func__);
+ return;
+ }
for (int i = 0; i < p_num; i++)
players[i] = i;
qsort(players, p_num, sizeof(int), cmp_func);