From 0d767ca6974951a8fcdc270ca57f0d8c62819fcc Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Sat, 12 Jan 2019 13:48:52 +0100 Subject: [PATCH] mqtt: throw an error if no publish and subscribe topic is given --- lib/nodes/mqtt.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/nodes/mqtt.c b/lib/nodes/mqtt.c index 2c226264a..9cbe068ce 100644 --- a/lib/nodes/mqtt.c +++ b/lib/nodes/mqtt.c @@ -171,6 +171,9 @@ int mqtt_parse(struct node *n, json_t *cfg) m->username = username ? strdup(username) : NULL; m->password = password ? strdup(password) : NULL; + if (!m->publish && !m->subscribe) + error("At least one topic has to be specified for node %s", node_name(n)); + if (json_ssl) { const char *cafile = NULL; const char *capath = NULL;