From 6db671f955eb6b39e88314251fc9b44206af059f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A4=D1=80=D0=BE=D0=BB=D0=BE=D0=B2?= Date: Fri, 20 Aug 2021 13:56:20 +0500 Subject: [PATCH] fixed nullReference in mapping filePropertiesDto --- AsbCloudInfrastructure/Services/FileService.cs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/AsbCloudInfrastructure/Services/FileService.cs b/AsbCloudInfrastructure/Services/FileService.cs index a036908b..b5103589 100644 --- a/AsbCloudInfrastructure/Services/FileService.cs +++ b/AsbCloudInfrastructure/Services/FileService.cs @@ -106,10 +106,8 @@ namespace AsbCloudInfrastructure.Services foreach (var item in entities) { var filePropertiesDto = item.Adapt(); - filePropertiesDto.AuthorName = item.Author.Name; - filePropertiesDto.CompanyId = item.Author.IdCompany != null - ? item.Author.Company.Id - : 0; + filePropertiesDto.AuthorName = item.Author?.Name; + filePropertiesDto.CompanyId = item.Author?.IdCompany ?? 0; result.Items.Add(filePropertiesDto); }