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:
parent
1a5a548fbf
commit
ab4d3c025e
@ -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() {
|
||||
|
Loading…
Reference in New Issue
Block a user