Make sure no nullreferenceexception is thrown if invalid invoice

This commit is contained in:
nicolas.dorier
2019-02-21 19:36:05 +09:00
parent 6ba17e8e30
commit 52fee8f842
2 changed files with 3 additions and 1 deletions

View File

@@ -34,6 +34,8 @@ namespace BTCPayServer.Controllers
[MediaTypeConstraint("application/json")]
public async Task<DataWrapper<InvoiceResponse>> CreateInvoice([FromBody] CreateInvoiceRequest invoice)
{
if (invoice == null)
throw new BitpayHttpException(400, "Invalid invoice");
return await _InvoiceController.CreateInvoiceCore(invoice, HttpContext.GetStoreData(), HttpContext.Request.GetAbsoluteRoot());
}