Fix: BlinkLightningClient.GetInvoice should not crash when the invoice is not found

This commit is contained in:
nicolas.dorier
2025-07-02 23:28:30 +09:00
parent 133b4bac03
commit 1ffe90da2f

View File

@@ -179,9 +179,8 @@ query InvoiceByPaymentHash($paymentHash: PaymentHash!, $walletId: WalletId!) {
}
};
var response = await _client.SendQueryAsync<dynamic>(reques, cancellation);
return response.Data is null ? null : ToInvoice(response.Data.me.defaultAccount.walletById.invoiceByPaymentHash);
var result = response.Data?.SelectToken("me.defaultAccount.walletById.invoiceByPaymentHash") as JObject;
return result is null ? null : ToInvoice(result);
}
public LightningInvoice? ToInvoice(JObject invoice)