Skip to content

Commit

Permalink
fix(HearthDbConverter): crash in ToHearthDbDeck due to invalid property
Browse files Browse the repository at this point in the history
  • Loading branch information
beheh committed Dec 22, 2023
1 parent ad2608c commit ed72f36
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions Hearthstone Deck Tracker/Hearthstone/HearthDbConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -328,8 +328,12 @@ public static BnetGameType GetBnetGameType(GameType gameType, Format? format)
{
dbfIds = cards.ToDictionary(c => c.DbfId, c => c.Count);
sideboards = deck.Sideboards.Select(s =>
new { owner = Database.GetCardFromId(s.Key), sideboard = s.Value.ToDictionary(c => c.DbfId, c => c.Count) }
).Where(s => s.owner != null).ToDictionary(s => s.owner!.DbfId, s => s.sideboard);
new
{
owner = Database.GetCardFromId(s.Key),
sideboard = s.Value.ToDictionary(c => Database.GetCardFromId(c.Id)?.DbfId ?? 0, c => c.Count)
}
).Where(s => s.owner != null && s.sideboard.Keys.All(x => x != 0)).ToDictionary(s => s.owner!.DbfId, s => s.sideboard);
}
catch
{
Expand Down

0 comments on commit ed72f36

Please sign in to comment.