diff --git a/src/AddIn/RegistryUtil.cs b/src/AddIn/RegistryUtil.cs index dabd74d..5fe2eea 100644 --- a/src/AddIn/RegistryUtil.cs +++ b/src/AddIn/RegistryUtil.cs @@ -38,6 +38,12 @@ namespace RehauSku if (result == DialogResult.OK) { string fileName = Dialog.GetFilePath(); + + if (string.IsNullOrEmpty(fileName)) + { + throw new Exception("Нет файла шаблона"); + } + priceListPath = fileName; RootKey.SetValue("PriceListPath", fileName); return priceListPath; diff --git a/src/Interface/Dialog.cs b/src/Interface/Dialog.cs index 806e92d..23f65d7 100644 --- a/src/Interface/Dialog.cs +++ b/src/Interface/Dialog.cs @@ -16,9 +16,9 @@ namespace RehauSku.Interface { return dialog.FileName; } - } - return string.Empty; + else return string.Empty; + } } public static string[] GetMultiplyFiles() diff --git a/src/Interface/RibbonController.cs b/src/Interface/RibbonController.cs index b2e7b28..822fe98 100644 --- a/src/Interface/RibbonController.cs +++ b/src/Interface/RibbonController.cs @@ -91,7 +91,11 @@ namespace RehauSku.Interface public void OnSetPricePressed(IRibbonControl control) { string path = Dialog.GetFilePath(); - RegistryUtil.PriceListPath = path; + + if (!string.IsNullOrEmpty(path)) + { + RegistryUtil.PriceListPath = path; + } } } }