From 5f46b48d45ff9ce15787f6979bde469fa2bce215 Mon Sep 17 00:00:00 2001 From: Dennis Reimann Date: Thu, 17 Dec 2020 06:43:43 +0100 Subject: [PATCH] API: Fix for invoice not found (#2148) In case the invoice ID was invalid, this resulted in an exception instead of a 404. --- BTCPayServer/Controllers/GreenField/InvoiceController.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BTCPayServer/Controllers/GreenField/InvoiceController.cs b/BTCPayServer/Controllers/GreenField/InvoiceController.cs index 0b3235f17..3828c185d 100644 --- a/BTCPayServer/Controllers/GreenField/InvoiceController.cs +++ b/BTCPayServer/Controllers/GreenField/InvoiceController.cs @@ -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(); }