Ignore invalid server entries instead of the entire list.

This commit is contained in:
Paul Chote
2021-01-29 22:50:02 +00:00
committed by abcdefg30
parent df1191db5b
commit 2c09b1414c

View File

@@ -334,14 +334,24 @@ namespace OpenRA.Mods.Common.Widgets.Logic
List<GameServer> games = null;
if (i.Error == null)
{
games = new List<GameServer>();
try
{
var data = Encoding.UTF8.GetString(i.Result);
var yaml = MiniYaml.FromString(data);
games = yaml.Select(a => new GameServer(a.Value))
.Where(gs => gs.Address != null)
.ToList();
foreach (var node in yaml)
{
try
{
var gs = new GameServer(node.Value);
if (gs.Address != null)
games.Add(gs);
}
catch
{
// Ignore any invalid games advertised.
}
}
}
catch
{