From 1e7b332716e0d495d5be1b96786439073a3b40e4 Mon Sep 17 00:00:00 2001 From: darosior Date: Fri, 11 Oct 2019 12:11:40 +0200 Subject: [PATCH] plugin_control: don't assume plugin exists on error Actually it often does not since there was an error.. --- lightningd/plugin_control.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lightningd/plugin_control.c b/lightningd/plugin_control.c index 897ad99ac..41006f575 100644 --- a/lightningd/plugin_control.c +++ b/lightningd/plugin_control.c @@ -34,9 +34,13 @@ static struct command_result *plugin_dynamic_list_plugins(struct command *cmd) static struct command_result * plugin_dynamic_error(struct dynamic_plugin *dp, const char *error) { - plugin_kill(dp->plugin, "%s: %s", dp->plugin->cmd, error); + if (dp->plugin) + plugin_kill(dp->plugin, "%s", error); + else + log_info(dp->cmd->ld->log, "%s", error); return command_fail(dp->cmd, JSONRPC2_INVALID_PARAMS, - "%s: %s", dp->plugin->cmd, error); + "%s: %s", dp->plugin ? dp->plugin->cmd : "unknown plugin", + error); } static void plugin_dynamic_timeout(struct dynamic_plugin *dp)