Fixed crash when trying to get DLCs for certain games.
This commit is contained in:
parent
32410ca254
commit
81bd241e26
@ -114,15 +114,11 @@ namespace auto_creamapi.Services
|
|||||||
steamAppDetails.DLC.ForEach(x =>
|
steamAppDetails.DLC.ForEach(x =>
|
||||||
{
|
{
|
||||||
var result = _cache.FirstOrDefault(y => y.AppId.Equals(x));
|
var result = _cache.FirstOrDefault(y => y.AppId.Equals(x));
|
||||||
if (result == null)
|
if (result == null) return;
|
||||||
{
|
|
||||||
var dlcDetails = AppDetails.GetAsync(x).Result;
|
var dlcDetails = AppDetails.GetAsync(x).Result;
|
||||||
result = dlcDetails != null
|
dlcList.Add(dlcDetails != null
|
||||||
? new SteamApp { AppId = dlcDetails.SteamAppId, Name = dlcDetails.Name }
|
? new SteamApp { AppId = dlcDetails.SteamAppId, Name = dlcDetails.Name }
|
||||||
: new SteamApp { AppId = x, Name = $"Unknown DLC {x}" };
|
: new SteamApp { AppId = x, Name = $"Unknown DLC {x}" });
|
||||||
}
|
|
||||||
|
|
||||||
dlcList.Add(result);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
dlcList.ForEach(x => MyLogger.Log.Debug($"{x.AppId}={x.Name}"));
|
dlcList.ForEach(x => MyLogger.Log.Debug($"{x.AppId}={x.Name}"));
|
||||||
@ -160,9 +156,10 @@ namespace auto_creamapi.Services
|
|||||||
foreach (var element in query2)
|
foreach (var element in query2)
|
||||||
{
|
{
|
||||||
var dlcId = element.GetAttribute("data-appid");
|
var dlcId = element.GetAttribute("data-appid");
|
||||||
var dlcName = $"Unknown DLC {dlcId}";
|
|
||||||
var query3 = element.QuerySelectorAll("td");
|
var query3 = element.QuerySelectorAll("td");
|
||||||
if (query3 != null) dlcName = query3[1].Text().Replace("\n", "").Trim();
|
var dlcName = query3 == null
|
||||||
|
? $"Unknown DLC {dlcId}"
|
||||||
|
: query3[1].Text().Replace("\n", "").Trim();
|
||||||
|
|
||||||
if (ignoreUnknown && dlcName.Contains("SteamDB Unknown App"))
|
if (ignoreUnknown && dlcName.Contains("SteamDB Unknown App"))
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user