Add security checks

This commit is contained in:
Nathanaël Lécaudé 2016-11-10 16:45:01 -05:00
parent 96820418b5
commit 869ae01da9
1 changed files with 4 additions and 2 deletions

View File

@ -439,7 +439,9 @@ module.exports = function(RED) {
//node.log(RED._("tcpin.errors.client-connected"));
node.status({fill:"green",shape:"dot",text:"common.status.connected"});
node.connected = true;
clients[cid].write(msg.payload);
if (clients[cid]) {
clients[cid].write(msg.payload);
}
});
}
else {
@ -459,7 +461,7 @@ module.exports = function(RED) {
for (var j = 0; j < data.length; j++ ) {
if (node.out === "time") {
// do the timer thing
if (clients[cid].timeout) {
if (clients[cid] && clients[cid].timeout) {
i += 1;
buf[i] = data[j];
}