From 7abc491f4c214f2bcf9e8f2b9066ca05dee0342b Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Thu, 24 Mar 2022 12:49:25 +1030 Subject: [PATCH] pay: fix crash on invalid onion in reply in some cases. fail can be NULL here. Reported-by: https://github.com/shafemtol Fixes: #5053 Signed-off-by: Rusty Russell --- lightningd/pay.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lightningd/pay.c b/lightningd/pay.c index 9c2c05157..58463ee10 100644 --- a/lightningd/pay.c +++ b/lightningd/pay.c @@ -212,7 +212,7 @@ void json_sendpay_fail_fields(struct json_stream *js, json_add_payment_fields(js, payment); if (pay_errcode == PAY_UNPARSEABLE_ONION && onionreply) json_add_hex_talarr(js, "onionreply", onionreply->contents); - else + else if (fail) json_add_routefail_info(js, fail->erring_index, fail->failcode,