From e08528b7b5cf5063a20da745b8013f132521759d Mon Sep 17 00:00:00 2001 From: Simon Vrouwe Date: Mon, 8 Nov 2021 16:22:49 +0200 Subject: [PATCH] libplugin-pay: fix valgrind error for the case rpc "listpeers" returns an error, such as in shutdown --- plugins/libplugin-pay.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/libplugin-pay.c b/plugins/libplugin-pay.c index 01626e664..e2d240ba2 100644 --- a/plugins/libplugin-pay.c +++ b/plugins/libplugin-pay.c @@ -3231,7 +3231,7 @@ static struct command_result *direct_pay_listpeers(struct command *cmd, json_to_listpeers_result(tmpctx, buffer, toks); 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]; if (!peer->connected) goto cont;