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 <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2022-03-24 12:49:25 +10:30
parent 5c20b8b1a3
commit 7abc491f4c
1 changed files with 1 additions and 1 deletions

View File

@ -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,