Skip to content

Commit d7bdcd6

Browse files
author
dceejay
committed
fix exec missing addpayload,
improve switch null test (to include null object) check mqtt has payload before sending
1 parent 87e537d commit d7bdcd6

3 files changed

Lines changed: 4 additions & 3 deletions

File tree

nodes/core/core/75-exec.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ module.exports = function(RED) {
2323
function ExecNode(n) {
2424
RED.nodes.createNode(this,n);
2525
this.cmd = (n.command || "").trim();
26+
if (n.addpay == undefined) { n.addpay = true; }
2627
this.addpay = n.addpay;
2728
this.append = (n.append || "").trim();
2829
this.useSpawn = n.useSpawn;

nodes/core/io/10-mqtt.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ module.exports = function(RED) {
106106
if (node.topic) {
107107
msg.topic = node.topic;
108108
}
109-
if ((msg.hasOwnProperty("topic")) && (typeof msg.topic === "string") && (msg.topic !== "")) { // topic must exist
109+
if (msg.hasOwnProperty("payload") && (msg.hasOwnProperty("topic")) && (typeof msg.topic === "string") && (msg.topic !== "")) { // topic must exist
110110
this.client.publish(msg); // send the message
111111
}
112112
else { node.warn("Invalid topic specified"); }

nodes/core/logic/10-switch.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ module.exports = function(RED) {
2828
'regex': function(a, b) { return (a + "").match(new RegExp(b)); },
2929
'true': function(a) { return a === true; },
3030
'false': function(a) { return a === false; },
31-
'null': function(a) { return typeof a == "undefined"; },
32-
'nnull': function(a) { return typeof a != "undefined"; },
31+
'null': function(a) { return (typeof a == "undefined" || a === null); },
32+
'nnull': function(a) { return (typeof a != "undefined" && a !== null); },
3333
'else': function(a) { return a === true; }
3434
};
3535

0 commit comments

Comments
 (0)