mirror of
https://github.com/node-red/node-red
synced 2024-11-23 08:59:13 +00:00
MQTT node better check for topic existing
This commit is contained in:
parent
ab4d3c025e
commit
cba4791b65
@ -95,7 +95,7 @@ module.exports = function(RED) {
|
||||
if (node.topic) {
|
||||
msg.topic = node.topic;
|
||||
}
|
||||
if (typeof msg.topic === "string") { // topic must be a string
|
||||
if ((msg.hasOwnProperty("topic")) && (typeof msg.topic === "string") && (msg.topic !== "")) { // topic must exist
|
||||
this.client.publish(msg); // send the message
|
||||
}
|
||||
else { node.warn("Invalid topic specified"); }
|
||||
|
Loading…
Reference in New Issue
Block a user