Fix null reference exception on empty measure field.

This commit is contained in:
Sergey Chebotar 2023-05-16 17:59:45 +03:00
parent 786a5bfe26
commit b06df453d2

View File

@ -110,7 +110,7 @@ public class ExcelReader : IReader, IDisposable
object name = worksheet.Cells[row, NameCell.Column].Value2; object name = worksheet.Cells[row, NameCell.Column].Value2;
object sku = worksheet.Cells[row, SkuCell.Column].Value2; object sku = worksheet.Cells[row, SkuCell.Column].Value2;
object measure = worksheet.Cells[row, MeasureCell.Column].Value2; object measure = worksheet.Cells[row, MeasureCell.Column].Value2;
var productMeasure = measure.ToString() switch var productMeasure = measure?.ToString() switch
{ {
"м" => Measure.M, "м" => Measure.M,
"шт" => Measure.P, "шт" => Measure.P,