From 62e3f2d8e1e29a3f045881c761d048ec5ee1b518 Mon Sep 17 00:00:00 2001 From: "nicolas.dorier" Date: Fri, 13 Oct 2017 14:53:42 +0900 Subject: [PATCH] Prevent null invoice to be added to InvoiceWatcher --- BTCPayServer/Services/Invoices/InvoiceWatcher.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/BTCPayServer/Services/Invoices/InvoiceWatcher.cs b/BTCPayServer/Services/Invoices/InvoiceWatcher.cs index 62c58e4e2..86a655345 100644 --- a/BTCPayServer/Services/Invoices/InvoiceWatcher.cs +++ b/BTCPayServer/Services/Invoices/InvoiceWatcher.cs @@ -46,7 +46,8 @@ namespace BTCPayServer.Servcices.Invoices public async Task NotifyReceived(Script scriptPubKey) { var invoice = await _Wallet.GetInvoiceId(scriptPubKey); - _WatchRequests.Add(invoice); + if(invoice != null) + _WatchRequests.Add(invoice); } public async Task NotifyBlock() @@ -240,6 +241,8 @@ namespace BTCPayServer.Servcices.Invoices public async Task WatchAsync(string invoiceId, bool singleShot = false) { + if(invoiceId == null) + throw new ArgumentNullException(nameof(invoiceId)); if(!singleShot) await _InvoiceRepository.AddPendingInvoice(invoiceId).ConfigureAwait(false); _WatchRequests.Add(invoiceId);