Improve error checks

This commit is contained in:
nicolas.dorier
2020-12-23 14:10:53 +09:00
parent f0fc0441bd
commit 0dcd834535

View File

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