1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Add security checks

This commit is contained in:
Nathanaël Lécaudé 2016-11-10 16:45:01 -05:00
parent 96820418b5
commit 869ae01da9

View File

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