From 1153619a03f2f138190c8d3e0a75de6862ff74e9 Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Tue, 4 Nov 2014 11:36:28 +0000 Subject: [PATCH] Handle uninitialised node in single-wire fastpath --- red/nodes/Node.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/red/nodes/Node.js b/red/nodes/Node.js index 066c16330..1b1300379 100644 --- a/red/nodes/Node.js +++ b/red/nodes/Node.js @@ -92,6 +92,7 @@ function cloneMessage(msg) { Node.prototype.send = function(msg) { var msgSent = false; + var node; if (msg === null || typeof msg === "undefined") { return; @@ -100,7 +101,10 @@ Node.prototype.send = function(msg) { // A single message and a single wire on output 0 // TODO: pre-load flows.get calls - cannot do in constructor // as not all nodes are defined at that point - flows.get(this._wire).receive(msg); + node = flows.get(this._wire); + if (node) { + node.receive(msg); + } return; } else { msg = [msg]; @@ -122,7 +126,6 @@ Node.prototype.send = function(msg) { if (!util.isArray(msgs)) { msgs = [msgs]; } - var node; var k = 0; // for each recipent node of that output for (var j = 0; j < wires.length; j++) {