diff --git a/VocaluxeLib/Menu/CMenuPartyNameSelection.cs b/VocaluxeLib/Menu/CMenuPartyNameSelection.cs index 423d89e8..92527d08 100644 --- a/VocaluxeLib/Menu/CMenuPartyNameSelection.cs +++ b/VocaluxeLib/Menu/CMenuPartyNameSelection.cs @@ -774,7 +774,8 @@ namespace VocaluxeLib.Menu for (int p = 0; p < _NumPlayerTeams[t]; p++) { int profileID = _NameSelections[_NameSelection].GetRandomUnusedProfile(); - _AddPlayer(t, profileID); + if(profileID >= 0) //only add valid profiles + _AddPlayer(t, profileID); } } } diff --git a/VocaluxeLib/Menu/CNameSelection.cs b/VocaluxeLib/Menu/CNameSelection.cs index 37806b5f..1718d047 100644 --- a/VocaluxeLib/Menu/CNameSelection.cs +++ b/VocaluxeLib/Menu/CNameSelection.cs @@ -465,23 +465,11 @@ namespace VocaluxeLib.Menu public int GetRandomUnusedProfile() { - int id = -1; - if (_VisibleProfiles.Count == 0) - return id; + return -1; - if (_VisibleProfiles.Count == _UsedProfiles.Count) - return id; - - while (id == -1) - { - int rand = CBase.Game.GetRandom(_VisibleProfiles.Count); - if (_UsedProfiles.Contains(_VisibleProfiles[rand])) - continue; - id = _VisibleProfiles[rand]; - } - - return id; + int rand = CBase.Game.GetRandom(_VisibleProfiles.Count); + return _VisibleProfiles[rand]; } private void _PrepareTiles()