From: Slava Bacherikov Date: Tue, 12 Feb 2019 14:26:02 +0000 (+0200) Subject: Fix crash when g_maxplayers smaller than current amount of active players X-Git-Tag: xonotic-v0.8.5~1600^2 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=250b1e189a2098732efa511c488e8c765d7ea066;p=xonotic%2Fxonotic-data.pk3dir.git Fix crash when g_maxplayers smaller than current amount of active players --- diff --git a/qcsrc/server/bot/default/bot.qc b/qcsrc/server/bot/default/bot.qc index 9ebcffae3..2552cc4ba 100644 --- a/qcsrc/server/bot/default/bot.qc +++ b/qcsrc/server/bot/default/bot.qc @@ -611,7 +611,7 @@ bool bot_fixcount() // cap bots to the max players allowed by the server int player_limit = GetPlayerLimit(); if(player_limit) - bots = min(bots, player_limit - activerealplayers); + bots = min(bots, max(player_limit - activerealplayers, 0)); bots = min(bots, maxclients - realplayers); if(bots > minbots) @@ -634,7 +634,7 @@ bool bot_fixcount() return false; } } - while (currentbots > bots) + while (currentbots > bots && bots >= 0) bot_removenewest(); }