Merge pull request #11903 from abcdefg30/indexing

Fix a possible crash in the lua Player.Team property
This commit is contained in:
Oliver Brakmann
2016-08-28 14:16:48 +02:00
committed by GitHub
2 changed files with 1 additions and 5 deletions

View File

@@ -220,10 +220,6 @@ namespace OpenRA.Server
}) { IsBackground = true }.Start();
}
/* lobby rework TODO:
* - "teams together" option for team games -- will eliminate most need
* for manual spawnpoint choosing.
*/
int nextPlayerIndex;
public int ChooseFreePlayerIndex()
{

View File

@@ -54,7 +54,7 @@ namespace OpenRA.Mods.Common.Scripting
{
get
{
var c = Player.World.LobbyInfo.Clients[Player.ClientIndex];
var c = Player.World.LobbyInfo.Clients.FirstOrDefault(i => i.Index == Player.ClientIndex);
return c != null ? c.Team : 0;
}
}