1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

MQTT node should only send message if topic actually specified (string)

This commit is contained in:
Dave C-J 2014-09-08 20:01:28 +01:00
parent 1a5a548fbf
commit ab4d3c025e

View File

@ -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() {