Prevent crash when invalid or not yet created LAN games are discovered.
This commit is contained in:
@@ -339,6 +339,11 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
var lanGames = new List<GameServer>();
|
||||
foreach (var bl in lanGameLocations)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrEmpty(bl.Data))
|
||||
continue;
|
||||
|
||||
var game = MiniYaml.FromString(bl.Data)[0].Value;
|
||||
var idNode = game.Nodes.FirstOrDefault(n => n.Key == "Id");
|
||||
|
||||
@@ -352,11 +357,12 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
if (addressNode != null)
|
||||
addressNode.Value.Value = bl.Address.ToString().Split(':')[0] + ":" + addressNode.Value.Value.Split(':')[1];
|
||||
|
||||
try
|
||||
{
|
||||
lanGames.Add(new GameServer(game));
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
catch
|
||||
{
|
||||
// Ignore any invalid LAN games advertised.
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user