From 793b1b56d9b1a175111e6cc4027f8b2bc4bba4d0 Mon Sep 17 00:00:00 2001 From: Andrew Camilleri Date: Sat, 31 Oct 2020 11:34:40 +0100 Subject: [PATCH] Fix exception when saving checkout experience on new store (#2033) --- BTCPayServer/Controllers/StoresController.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/BTCPayServer/Controllers/StoresController.cs b/BTCPayServer/Controllers/StoresController.cs index 889c9e785..0d7153532 100644 --- a/BTCPayServer/Controllers/StoresController.cs +++ b/BTCPayServer/Controllers/StoresController.cs @@ -420,6 +420,7 @@ namespace BTCPayServer.Controllers } SetCryptoCurrencies(model, CurrentStore); model.SetLanguages(_LangService, model.DefaultLang); + model.PaymentMethodCriteria??= new List(); for (var index = 0; index < model.PaymentMethodCriteria.Count; index++) { var methodCriterion = model.PaymentMethodCriteria[index]; @@ -427,10 +428,12 @@ namespace BTCPayServer.Controllers { if (!CurrencyValue.TryParse(methodCriterion.Value, out var value)) { - model.AddModelError(viewModel => viewModel.PaymentMethodCriteria[index].Value, $"{methodCriterion.PaymentMethod}: invalid format (1.0 USD)", this); + model.AddModelError(viewModel => viewModel.PaymentMethodCriteria[index].Value, + $"{methodCriterion.PaymentMethod}: invalid format (1.0 USD)", this); } } } + if (!ModelState.IsValid) {