From aea6e224c28401755c80d6b90b9398c59c09b161 Mon Sep 17 00:00:00 2001 From: Sergey Chebotar Date: Fri, 28 Jan 2022 12:33:21 +0300 Subject: [PATCH] Exit loop if first search returns nothing --- src/PriceListTools/PriceListTool.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/PriceListTools/PriceListTool.cs b/src/PriceListTools/PriceListTool.cs index cf2cd59..c3cc137 100644 --- a/src/PriceListTools/PriceListTool.cs +++ b/src/PriceListTools/PriceListTool.cs @@ -39,6 +39,12 @@ namespace RehauSku.PriceListTools foreach (var kvp in dictionary) { Range foundCell = TargetFile.skuCell.EntireColumn.Find(kvp.Key.Sku); + if (foundCell == null) + { + missing.Add(kvp); + continue; + } + string foundCellGroup = groupColumn[foundCell.Row, 1].ToString(); while (foundCell != null && foundCellGroup != kvp.Key.Group)