From ab4d3c025e4e338b5b86cddde29d295599dd9aab Mon Sep 17 00:00:00 2001 From: Dave C-J Date: Mon, 8 Sep 2014 20:01:28 +0100 Subject: [PATCH] MQTT node should only send message if topic actually specified (string) --- nodes/core/io/10-mqtt.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/nodes/core/io/10-mqtt.js b/nodes/core/io/10-mqtt.js index 3eac84f85..90636500b 100644 --- a/nodes/core/io/10-mqtt.js +++ b/nodes/core/io/10-mqtt.js @@ -95,7 +95,10 @@ module.exports = function(RED) { if (node.topic) { msg.topic = node.topic; } - this.client.publish(msg); + if (typeof msg.topic === "string") { // topic must be a string + this.client.publish(msg); // send the message + } + else { node.warn("Invalid topic specified"); } } }); this.client.on("connectionlost",function() {