pay: Fix a null-dereference introduced in #6428

The alias may not be set for non-alias channels after they
confirm. The other branch is safe because we only consider active
channels.

Changelog-None
Fixes #6450
This commit is contained in:
Christian Decker 2023-07-27 11:36:24 +02:00 committed by Rusty Russell
parent f51ce7be85
commit 5f2072869a

View File

@ -2405,10 +2405,12 @@ local_channel_hints_listpeerchannels(struct command *cmd, const char *buffer,
channel_hints_update(
p, *chans[i]->scid, chans[i]->direction, enabled,
true, &chans[i]->spendable_msat, &htlc_budget);
channel_hints_update(p, *chans[i]->alias[LOCAL],
chans[i]->direction,
false /* not enabled */, true,
&AMOUNT_MSAT(0), &htlc_budget);
if (chans[i]->alias[LOCAL] != NULL)
channel_hints_update(p, *chans[i]->alias[LOCAL],
chans[i]->direction,
false /* not enabled */,
true, &AMOUNT_MSAT(0),
&htlc_budget);
} else {
channel_hints_update(p, *chans[i]->alias[LOCAL],
chans[i]->direction, enabled, true,