Skip to content

Commit bec487c

Browse files
committed
Bugfix: Check if steam request was successfull
1 parent 88deed6 commit bec487c

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

DiscordModNotifiyer/Apis/SteamApi.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public async Task UpdateSteamMods()
7676

7777
jsonContent = await response.Content.ReadAsStringAsync();
7878
var model = JsonConvert.DeserializeObject<SteamCollectionModel>(jsonContent);
79-
var modIds = model.response.collectiondetails.FirstOrDefault()?.children.Select(x => x.publishedfileid);
79+
var modIds = model.response.collectiondetails.FirstOrDefault()?.children?.Select(x => x.publishedfileid);
8080

8181
await CheckSteamMods(modIds.ToList());
8282
}
@@ -142,14 +142,21 @@ private async Task CheckSteamMods(List<double> modIds)
142142
LastUpdate = mod.time_updated.ToString()
143143
});
144144
}
145-
else
145+
else if(mod.time_updated != 0) // Check if steam request was successfull
146146
{
147147
if(Program.Settings.Debug)
148148
{
149149
ConsoleExtensions.WriteColor($"[// Debug ]Mod Id {sMod.ModId} \"{mod.publishedfileid}\" need a update cause the timestamps are not even ({sMod.LastUpdate} != {mod.time_updated})", ConsoleColor.Yellow);
150150
}
151151
savedMods.Find(x => x.ModId.Equals(mod.publishedfileid.ToString())).LastUpdate = mod.time_updated.ToString();
152152
}
153+
else
154+
{
155+
if(Program.Settings.Debug)
156+
{
157+
ConsoleExtensions.WriteColor($"[// Debug ]Mod Id {sMod.ModId} \"{mod.publishedfileid}\" was skipped cause time update value from request was 0", ConsoleColor.Yellow);
158+
}
159+
}
153160
}
154161
}
155162

0 commit comments

Comments
 (0)