mirror of
				https://github.com/node-red/node-red.git
				synced 2025-03-01 10:36:34 +00:00 
			
		
		
		
	MQTT node should only send message if topic actually specified (string)
This commit is contained in:
		| @@ -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() { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user