mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02: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) {
|
if (node.topic) {
|
||||||
msg.topic = 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
|
this.client.publish(msg); // send the message
|
||||||
}
|
}
|
||||||
else { node.warn("Invalid topic specified"); }
|
else { node.warn("Invalid topic specified"); }
|
||||||
|
Loading…
Reference in New Issue
Block a user