lightningd/jsonrpc: don't assume the jcon to be alive at command execution

Signed-off-by: Antoine Poinsot <darosior@protonmail.com>
This commit is contained in:
Antoine Poinsot
2020-06-16 12:29:32 +02:00
committed by Christian Decker
parent 2900da6112
commit 3e9fcc43f9

View File

@@ -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;
}