From 5dcc91e4a13e35588a8b0dfc8fda391076122a0b Mon Sep 17 00:00:00 2001 From: Sergey Chebotar Date: Tue, 22 Mar 2022 15:14:43 +0300 Subject: Fix null reference error --- src/PriceListTools/AbstractTool.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/PriceListTools') diff --git a/src/PriceListTools/AbstractTool.cs b/src/PriceListTools/AbstractTool.cs index 256be06..f312e95 100644 --- a/src/PriceListTools/AbstractTool.cs +++ b/src/PriceListTools/AbstractTool.cs @@ -135,7 +135,6 @@ namespace RehauSku.PriceListTools protected int? GetPositionRow(Range range, string sku, string group) { Range found = range.Find(sku); - string foundGroupValue; if (found == null) { @@ -146,9 +145,11 @@ namespace RehauSku.PriceListTools while (true) { - foundGroupValue = TargetFile.Sheet.Cells[found.Row, TargetFile.GroupCell.Column].Value2.ToString(); + Range groupCell = TargetFile.Sheet.Cells[found.Row, TargetFile.GroupCell.Column]; - if (string.IsNullOrEmpty(group) || group.Equals(foundGroupValue)) + if (string.IsNullOrEmpty(group) || + string.IsNullOrEmpty(groupCell.Value2.ToString()) || + group.Equals(groupCell.Value2.ToString())) { return found.Row; } -- cgit v1.2.3