Remove redundant msg != null checks.

This commit is contained in:
Mark Hindess
2014-09-08 21:42:16 +01:00
parent 68c9e2b41a
commit b1ba8369d4
6 changed files with 39 additions and 51 deletions

View File

@@ -25,18 +25,16 @@ module.exports = function(RED) {
var node = this;
this.on("input", function(msg) {
if (msg != null) {
var mac = this.mac || msg.mac || null;
if (mac != null) {
if (chk.test(mac)) {
wol.wake(mac, function(error) {
if (error) { node.warn(error); }
});
}
else { node.warn('WOL: bad mac address "'+mac+'"'); }
var mac = this.mac || msg.mac || null;
if (mac != null) {
if (chk.test(mac)) {
wol.wake(mac, function(error) {
if (error) { node.warn(error); }
});
}
else { node.warn("WOL: no mac address specified"); }
else { node.warn('WOL: bad mac address "'+mac+'"'); }
}
else { node.warn("WOL: no mac address specified"); }
});
}
RED.nodes.registerType("wake on lan",WOLnode);