From 786a5bfe2638477576ca2936174cfd83d2d03bba Mon Sep 17 00:00:00 2001 From: Sergey Chebotar Date: Tue, 16 May 2023 17:04:30 +0300 Subject: [PATCH] Fix empty ProductLines field exception on writing --- RhSolutions.AddIn/Services/ExcelWriter.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RhSolutions.AddIn/Services/ExcelWriter.cs b/RhSolutions.AddIn/Services/ExcelWriter.cs index 4ac4f2b..ab04c50 100644 --- a/RhSolutions.AddIn/Services/ExcelWriter.cs +++ b/RhSolutions.AddIn/Services/ExcelWriter.cs @@ -182,7 +182,7 @@ public class ExcelWriter : IWriter, IDisposable previous.Copy(current); current.ClearContents(); - worksheetCells[row, groupColumn].Value2 = positionAmount.Key.ProductLines.First(); + worksheetCells[row, groupColumn].Value2 = positionAmount.Key.ProductLines.FirstOrDefault() ?? string.Empty; worksheetCells[row, nameColumn].Value2 = positionAmount.Key.Name; if (_oldSkuCell != null)