From 2c09b1414cf3af4a7267c12ea902f0b4a5f3f732 Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Fri, 29 Jan 2021 22:50:02 +0000 Subject: [PATCH] Ignore invalid server entries instead of the entire list. --- .../Widgets/Logic/ServerListLogic.cs | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/OpenRA.Mods.Common/Widgets/Logic/ServerListLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/ServerListLogic.cs index 8eb1aef40b..3d3b39d80b 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/ServerListLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/ServerListLogic.cs @@ -334,14 +334,24 @@ namespace OpenRA.Mods.Common.Widgets.Logic List games = null; if (i.Error == null) { + games = new List(); 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 {