Skip to content

Commit

Permalink
Fix: Crash when setting game category #226
Browse files Browse the repository at this point in the history
  • Loading branch information
JosefNemec committed Oct 21, 2017
1 parent 1d00cea commit 57ece8a
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions source/PlayniteUI/Windows/CategoryConfigWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -235,15 +235,16 @@ private void DataChanged(object data)
EnableThreeState = false;
if (Game.Categories != null)
{
// Also offer categories that are held by current game instance, but are not in DB yet
foreach (var cat in Game.Categories.Except(Categories.Select(a => a.Name)))
{
Categories.Add(new Category(cat, true));
}

foreach (var cat in Game.Categories)
{
var existingCat = Categories.FirstOrDefault(a => string.Equals(a.Name, cat, StringComparison.OrdinalIgnoreCase));

if (existingCat == null)
{
existingCat.Enabled = false;
}
else
if (existingCat != null)
{
existingCat.Enabled = true;
}
Expand Down

0 comments on commit 57ece8a

Please sign in to comment.