mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 15:14:23 +01:00
json_add_invoice: fix crash if missing invstring
If this field is missing for whatever reason (weird db state?) clightning will crash when listing invoices. Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
committed by
Rusty Russell
parent
167fade0fa
commit
ff84b3f773
@@ -39,6 +39,7 @@ static void json_add_invoice(struct json_stream *response,
|
|||||||
const struct invoice_details *inv)
|
const struct invoice_details *inv)
|
||||||
{
|
{
|
||||||
json_add_escaped_string(response, "label", inv->label);
|
json_add_escaped_string(response, "label", inv->label);
|
||||||
|
if (inv->invstring)
|
||||||
json_add_invstring(response, inv->invstring);
|
json_add_invstring(response, inv->invstring);
|
||||||
json_add_sha256(response, "payment_hash", &inv->rhash);
|
json_add_sha256(response, "payment_hash", &inv->rhash);
|
||||||
if (inv->msat)
|
if (inv->msat)
|
||||||
|
|||||||
Reference in New Issue
Block a user