API: Fix for invoice not found (#2148)

In case the invoice ID was invalid, this resulted in an exception instead of a 404.
This commit is contained in:
Dennis Reimann
2020-12-17 06:43:43 +01:00
committed by GitHub
parent 0cc24c8076
commit 5f46b48d45

View File

@@ -263,7 +263,7 @@ namespace BTCPayServer.Controllers.GreenField
}
var invoice = await _invoiceRepository.GetInvoice(invoiceId, true);
if (invoice.StoreId != store.Id)
if (invoice?.StoreId != store.Id)
{
return NotFound();
}