Improve error checks

This commit is contained in:
nicolas.dorier 2020-12-23 14:10:53 +09:00
parent f0fc0441bd
commit 0dcd834535
No known key found for this signature in database
GPG Key ID: 6618763EF09186FE

View File

@ -119,7 +119,7 @@ namespace BTCPayServer.Controllers.GreenField
{
return NotFound();
}
if (string.IsNullOrEmpty(paymentMethodData.DerivationScheme))
if (string.IsNullOrEmpty(paymentMethodData?.DerivationScheme))
{
ModelState.AddModelError(nameof(OnChainPaymentMethodData.DerivationScheme),
"Missing derivationScheme");
@ -188,6 +188,14 @@ namespace BTCPayServer.Controllers.GreenField
return NotFound();
}
if (string.IsNullOrEmpty(paymentMethodData?.DerivationScheme))
{
ModelState.AddModelError(nameof(OnChainPaymentMethodData.DerivationScheme),
"Missing derivationScheme");
}
if (!ModelState.IsValid)
return this.CreateValidationError(ModelState);
try
{
var store = Store;