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

@@ -42,8 +42,7 @@ module.exports = function(RED) {
var p2 = /[0-9]+,[0-9]+,[0-9]+/
if (device) {
this.on("input", function(msg) {
if (msg != null) {
this.on("input", function(msg) {
if (p1.test(msg.payload)) {
var r = parseInt(msg.payload.slice(1,3),16);
var g = parseInt(msg.payload.slice(3,5),16);
@@ -57,8 +56,7 @@ module.exports = function(RED) {
} else {
node.warn("incompatable input - " + msg.payload);
}
}
});
});
} else {
node.warn("no digispark RGB found");
}