diff --git a/OpenRA.Mods.RA/ServerTraits/LobbyCommands.cs b/OpenRA.Mods.RA/ServerTraits/LobbyCommands.cs index 556b0b8f02..e7e0c2b6a8 100644 --- a/OpenRA.Mods.RA/ServerTraits/LobbyCommands.cs +++ b/OpenRA.Mods.RA/ServerTraits/LobbyCommands.cs @@ -333,15 +333,18 @@ namespace OpenRA.Mods.RA.Server server.SendChatTo(conn, "Number of teams could not be parsed: {0}".F(s)); return true; } - teams = teams.Clamp(2, 8); var clients = server.lobbyInfo.Slots .Select(slot => server.lobbyInfo.Clients.SingleOrDefault(c => c.Slot == slot.Key)) .Where(c => c != null && !server.lobbyInfo.Slots[c.Slot].LockTeam).ToArray(); + if (clients.Length < 2) + { + server.SendChatTo(conn, "Not enough clients to assign teams"); + return true; + } var teamSizes = new int[clients.Length]; - for (var i = 0; i < clients.Length; i++) teamSizes[i % teams]++; diff --git a/OpenRA.Mods.RA/Widgets/Logic/LobbyLogic.cs b/OpenRA.Mods.RA/Widgets/Logic/LobbyLogic.cs index 2a3e159efe..9250b9bcdb 100644 --- a/OpenRA.Mods.RA/Widgets/Logic/LobbyLogic.cs +++ b/OpenRA.Mods.RA/Widgets/Logic/LobbyLogic.cs @@ -163,7 +163,8 @@ namespace OpenRA.Mods.RA.Widgets.Logic if (assignTeams != null) { assignTeams.IsVisible = () => Game.IsHost; - assignTeams.IsDisabled = () => gameStarting || orderManager.LocalClient == null || orderManager.LocalClient.IsReady; + assignTeams.IsDisabled = () => gameStarting || orderManager.LobbyInfo.Clients.Count < 2 + || orderManager.LocalClient == null || orderManager.LocalClient.IsReady; assignTeams.OnMouseDown = _ => {