Skip to content

Commit 487ba2c

Browse files
committed
Skip comics without images.
1 parent cdaee4f commit 487ba2c

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

ExampleDataApis/Configure.Db.Xkcd.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,11 @@ public static void SeedXkcd(this IDbConnection db)
2626

2727
foreach (var comic in comics)
2828
{
29-
var dimension = dimensions.First(x => x.Id == comic.Id);
29+
var dimension = dimensions.FirstOrDefault(x => x?.Id == comic.Id);
30+
if (dimension == null)
31+
{
32+
continue;
33+
}
3034
comic.Width = dimension.Width;
3135
comic.Height = dimension.Height;
3236
}

0 commit comments

Comments
 (0)