From f48fe0381525ae45908ed258e0b21a0f9f13a0e8 Mon Sep 17 00:00:00 2001 From: lisa neigut Date: Sat, 30 Mar 2019 22:48:01 -0700 Subject: [PATCH] plugins: patch in empty string when no default given If a plugin fails to pass in a default value for an option, c-lightning crashes. this fixes the crash. Patches #2515 --- lightningd/plugin.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lightningd/plugin.c b/lightningd/plugin.c index 976efdaaa..4d84ab3f9 100644 --- a/lightningd/plugin.c +++ b/lightningd/plugin.c @@ -984,6 +984,8 @@ static void plugin_config(struct plugin *plugin) list_for_each(&plugin->plugin_opts, opt, list) { /* Trim the `--` that we added before */ name = opt->name + 2; + if (!opt->value) + opt->value = ""; json_add_string(req->stream, name, opt->value); } json_object_end(req->stream); /* end of .params.options */