libplugin-pay: fix valgrind error

for the case rpc "listpeers" returns an error, such as in shutdown
This commit is contained in:
Simon Vrouwe
2021-11-08 16:22:49 +02:00
committed by Rusty Russell
parent aae5e7822f
commit e08528b7b5

View File

@@ -3231,7 +3231,7 @@ static struct command_result *direct_pay_listpeers(struct command *cmd,
json_to_listpeers_result(tmpctx, buffer, toks); json_to_listpeers_result(tmpctx, buffer, toks);
struct direct_pay_data *d = payment_mod_directpay_get_data(p); struct direct_pay_data *d = payment_mod_directpay_get_data(p);
if (tal_count(r->peers) == 1) { if (r && tal_count(r->peers) == 1) {
struct listpeers_peer *peer = r->peers[0]; struct listpeers_peer *peer = r->peers[0];
if (!peer->connected) if (!peer->connected)
goto cont; goto cont;