From 3e9fcc43f939caee3c79605e68994804ec687888 Mon Sep 17 00:00:00 2001 From: Antoine Poinsot Date: Tue, 16 Jun 2020 12:29:32 +0200 Subject: [PATCH] lightningd/jsonrpc: don't assume the jcon to be alive at command execution Signed-off-by: Antoine Poinsot --- lightningd/jsonrpc.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lightningd/jsonrpc.c b/lightningd/jsonrpc.c index 7e9352e30..eda944215 100644 --- a/lightningd/jsonrpc.c +++ b/lightningd/jsonrpc.c @@ -597,8 +597,10 @@ static struct command_result *command_exec(struct json_connection *jcon, if (res == &pending) assert(cmd->pending); - list_for_each(&jcon->commands, cmd, list) - assert(cmd->pending); + /* The command might outlive the connection. */ + if (jcon) + list_for_each(&jcon->commands, cmd, list) + assert(cmd->pending); return res; }