diff --git a/GameBrowser/Api/ServerApiEndpoints.cs b/GameBrowser/Api/ServerApiEndpoints.cs index 60c18d4..0687642 100644 --- a/GameBrowser/Api/ServerApiEndpoints.cs +++ b/GameBrowser/Api/ServerApiEndpoints.cs @@ -80,8 +80,8 @@ public object Get(GetDosGames request) { foreach (var item in dosGames) { - var parent = item.FindParent(); - if (parent.Name == "DOS") + var parent = item.FindParent(); + if (parent != null && parent.Name == "DOS") gameNameList.Add(item.Name); } } @@ -107,18 +107,18 @@ public object Get(GetWindowsGames request) IncludeItemTypes = new[] { typeof(Game).Name }, OrderBy = new[] { new ValueTuple(ItemSortBy.SortName, SortOrder.Ascending) } }).ToList(); - var gameNameList = new List(); if (windowsGames.Count > 0) { foreach (var item in windowsGames) { - var parent = item.FindParent(); - if (parent.Name == "PC") + var parent = item.FindParent(); + + + if (parent != null && parent.Name == "PC") gameNameList.Add(item.Name); } - } - + } return new GameQueryResult { TotalCount = gameNameList.Count,