Fix exception when saving checkout experience on new store (#2033)

This commit is contained in:
Andrew Camilleri 2020-10-31 11:34:40 +01:00 committed by GitHub
parent d8f9075e2a
commit 793b1b56d9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -420,6 +420,7 @@ namespace BTCPayServer.Controllers
}
SetCryptoCurrencies(model, CurrentStore);
model.SetLanguages(_LangService, model.DefaultLang);
model.PaymentMethodCriteria??= new List<PaymentMethodCriteriaViewModel>();
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)
{