Don't crash on unexpected pairing links

This commit is contained in:
Dean Herbert 2018-11-15 14:12:51 +09:00
parent 604cb4cb9e
commit 54b87e9c93
1 changed files with 4 additions and 1 deletions

View File

@ -104,7 +104,10 @@ private void load(Storage storage, FrameworkConfigManager frameworkConfig)
// link pairings to groupings
foreach (var group in Ladder.Groupings)
foreach (var id in group.Pairings)
Ladder.Pairings.Single(p => p.ID == id).Grouping.Value = group;
{
var found = Ladder.Pairings.FirstOrDefault(p => p.ID == id);
if (found != null) found.Grouping.Value = group;
}
Ladder.CurrentMatch.Value = Ladder.Pairings.FirstOrDefault(p => p.Current.Value);