diff --git a/packages/node_modules/@node-red/runtime/lib/nodes/context/index.js b/packages/node_modules/@node-red/runtime/lib/nodes/context/index.js index fda3852ff..56b0c7e6f 100644 --- a/packages/node_modules/@node-red/runtime/lib/nodes/context/index.js +++ b/packages/node_modules/@node-red/runtime/lib/nodes/context/index.js @@ -256,6 +256,9 @@ function createContext(id,seed,parent) { value: function(key, storage, callback) { var context; + if (typeof key !== "string" || !key.length) { + throw new Error("context get() requires 'key' to be a valid string"); + } if (!callback && typeof storage === 'function') { callback = storage; storage = undefined; @@ -338,6 +341,9 @@ function createContext(id,seed,parent) { value: function(key, value, storage, callback) { var context; + if (typeof key !== "string" || !key.length) { + throw new Error("context set() requires 'key' to be a valid string"); + } if (!callback && typeof storage === 'function') { callback = storage; storage = undefined;