From d1c42262d6ae9524c7a2cbde05deff25498f66bc Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Wed, 12 Apr 2017 20:48:43 +0100 Subject: [PATCH] Ensure all nodes have access to global context Fixes #1230 --- red/runtime/nodes/Node.js | 2 +- red/runtime/nodes/context.js | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/red/runtime/nodes/Node.js b/red/runtime/nodes/Node.js index 090bf171d..1ecfe5727 100644 --- a/red/runtime/nodes/Node.js +++ b/red/runtime/nodes/Node.js @@ -65,7 +65,7 @@ Node.prototype.updateWires = function(wires) { } Node.prototype.context = function() { if (!this._context) { - this._context = context.get(this._alias||this.id,this.z); + this._context = context.get(this._alias||this.id,this.z); } return this._context; } diff --git a/red/runtime/nodes/context.js b/red/runtime/nodes/context.js index 014653560..e89ac07ae 100644 --- a/red/runtime/nodes/context.js +++ b/red/runtime/nodes/context.js @@ -44,9 +44,9 @@ function getContext(localId,flowId) { var newContext = createContext(contextId); if (flowId) { newContext.flow = getContext(flowId); - if (globalContext) { - newContext.global = globalContext; - } + } + if (globalContext) { + newContext.global = globalContext; } contexts[contextId] = newContext; return newContext;