Merge pull request #392 from hindessm/remove-redundant-null-checks

Remove redundant msg != null checks.
This commit is contained in:
Nick O'Leary 2014-09-08 21:31:55 +01:00
commit 94b196bfcf
7 changed files with 163 additions and 182 deletions

View File

@ -27,7 +27,6 @@ module.exports = function(RED) {
var node = this;
this.on("input", function(msg) {
if (msg != null) {
node.status({fill:"blue",shape:"dot"});
if (this.useSpawn === true) {
// make the extra args into an array
@ -61,7 +60,6 @@ module.exports = function(RED) {
}
else { node.error("Spawn command must be just the command - no spaces or extra parameters"); }
}
else {
var cl = node.cmd+" "+msg.payload+" "+node.append;
node.log(cl);
@ -79,8 +77,6 @@ module.exports = function(RED) {
node.send([msg,msg2,msg3]);
});
}
}
});
}

View File

@ -39,7 +39,6 @@ module.exports = function(RED) {
try {
this.script = vm.createScript(functionText);
this.on("input", function(msg) {
if (msg != null) {
try {
var start = process.hrtime();
context.msg = msg;
@ -71,7 +70,6 @@ module.exports = function(RED) {
} catch(err) {
this.error(err.toString());
}
}
});
} catch(err) {
this.error(err);

View File

@ -47,7 +47,6 @@ module.exports = function(RED) {
}
node.on("input", function(msg) {
if (msg != null) {
try {
m = msg;
i = 0;
@ -55,7 +54,6 @@ module.exports = function(RED) {
} catch(err) {
node.error(err.message);
}
}
});
}

View File

@ -82,7 +82,6 @@ module.exports = function(RED) {
this.client = connectionPool.get(this.brokerConfig.broker,this.brokerConfig.port,this.brokerConfig.clientid,this.brokerConfig.username,this.brokerConfig.password);
var node = this;
this.on("input",function(msg) {
if (msg != null) {
if (msg.qos) {
msg.qos = parseInt(msg.qos);
if ((msg.qos !== 0) && (msg.qos !== 1) && (msg.qos !== 2)) {
@ -99,7 +98,6 @@ module.exports = function(RED) {
this.client.publish(msg); // send the message
}
else { node.warn("Invalid topic specified"); }
}
});
this.client.on("connectionlost",function() {
node.status({fill:"red",shape:"ring",text:"disconnected"});

View File

@ -244,8 +244,6 @@ module.exports = function(RED) {
access_token_secret: credentials.access_token_secret
});
node.on("input", function(msg) {
if (msg != null) {
node.status({fill:"blue",shape:"dot",text:"tweeting"});
if (msg.payload.length > 140) {
@ -279,8 +277,6 @@ module.exports = function(RED) {
form.append("status",msg.payload);
form.append("media[]",msg.media,{filename:"image"});
} else {
twit.updateStatus(msg.payload, function (err, data) {
if (err) {
@ -290,7 +286,6 @@ module.exports = function(RED) {
node.status({});
});
}
}
});
}
}

View File

@ -69,7 +69,6 @@ module.exports = function(RED) {
});
this.on("input", function(msg) {
if (msg != null) {
if (smtpTransport) {
node.status({fill:"blue",shape:"dot",text:"sending"});
var payload = RED.util.ensureString(msg.payload);
@ -89,7 +88,6 @@ module.exports = function(RED) {
});
}
else { node.warn("No Email credentials found. See info panel."); }
}
});
}
RED.nodes.registerType("e-mail",EmailNode,{

View File

@ -79,7 +79,6 @@ module.exports = function(RED) {
});
this.on("input", function(msg) {
if (msg != null) {
var k = this.key || msg.topic;
if (k) {
if (this.structtype == "string") {
@ -99,7 +98,6 @@ module.exports = function(RED) {
} else {
this.warn("No key or topic set");
}
}
});
this.on("close", function() {
redisConnectionPool.close(node.client);