Bug fix: Defensive FirstOrDefault. #194

This commit is contained in:
Robert McRackan 2022-02-03 08:53:41 -05:00
parent 426391f01c
commit 1f8a5b256e
2 changed files with 3 additions and 2 deletions

View File

@ -3,7 +3,7 @@
<PropertyGroup> <PropertyGroup>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net6.0</TargetFramework>
<Version>6.6.5.1</Version> <Version>6.6.6.1</Version>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View File

@ -120,7 +120,8 @@ namespace DtoImporterService
// 2+ // 2+
: item.Categories[1].CategoryId; : item.Categories[1].CategoryId;
var category = DbContext.Categories.Local.SingleOrDefault(c => c.AudibleCategoryId == lastCategory); // This should properly be SingleOrDefault() not FirstOrDefault(), but FirstOrDefault is defensive
var category = DbContext.Categories.Local.FirstOrDefault(c => c.AudibleCategoryId == lastCategory);
Book book; Book book;
try try