From a8cf33461678cf5c0d922649e14bf2aaac21988d Mon Sep 17 00:00:00 2001 From: Wouter Samaey Date: Fri, 25 Mar 2022 13:59:31 +0100 Subject: [PATCH] Update BTCPayServer/Services/Invoices/InvoiceRepository.cs Co-authored-by: Andrew Camilleri --- BTCPayServer/Services/Invoices/InvoiceRepository.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BTCPayServer/Services/Invoices/InvoiceRepository.cs b/BTCPayServer/Services/Invoices/InvoiceRepository.cs index 9f9bcea42..bfeb069bb 100644 --- a/BTCPayServer/Services/Invoices/InvoiceRepository.cs +++ b/BTCPayServer/Services/Invoices/InvoiceRepository.cs @@ -480,7 +480,7 @@ namespace BTCPayServer.Services.Invoices // OrderId is saved in 2 places: (1) the invoice table and (2) in the metadata field. We are updating both for consistency. invoiceData.OrderId = newOrderId; - if (oldOrderId != null && !newOrderId.Equals(oldOrderId, StringComparison.InvariantCulture)) + if (oldOrderId != null && (newOrderId is null || !newOrderId.Equals(oldOrderId, StringComparison.InvariantCulture))) { RemoveFromTextSearch(context, invoiceData, oldOrderId); }