]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Fix crash when g_maxplayers smaller than current amount of active players 637/head
authorSlava Bacherikov <slava@bacher09.org>
Tue, 12 Feb 2019 14:26:02 +0000 (16:26 +0200)
committerSlava Bacherikov <slava@bacher09.org>
Tue, 12 Feb 2019 14:30:36 +0000 (16:30 +0200)
qcsrc/server/bot/default/bot.qc

index 9ebcffae3c8383657da46d4b571e24dfcdd92b2a..2552cc4bab6827799f66f90244b715f9e2b5c52e 100644 (file)
@@ -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();
        }