Fix NRE when item has no category ladders (#715)

This commit is contained in:
Michael Bucari-Tovo 2023-08-17 11:29:42 -06:00
parent f175b7592e
commit 736d7c4a5f

View File

@ -23,9 +23,11 @@ namespace DtoImporterService
loadLocal_categories(); loadLocal_categories();
// upsert // upsert
//Import item may not have no (null) categories
var categoryLadders = importItems var categoryLadders = importItems
.Where(i => i.DtoItem.CategoryLadders is not null)
.SelectMany(i => i.DtoItem.CategoryLadders) .SelectMany(i => i.DtoItem.CategoryLadders)
.Select(cl => cl.Ladder) .Select(cl => cl?.Ladder)
.Where(l => l?.Length > 0) .Where(l => l?.Length > 0)
.ToList(); .ToList();