diff --git a/packages/node_modules/@node-red/editor-client/src/js/ui/env-var.js b/packages/node_modules/@node-red/editor-client/src/js/ui/env-var.js index db1a8e86f..998484858 100644 --- a/packages/node_modules/@node-red/editor-client/src/js/ui/env-var.js +++ b/packages/node_modules/@node-red/editor-client/src/js/ui/env-var.js @@ -50,7 +50,11 @@ RED.envVar = (function() { var new_env = []; var items = list.editableList('items'); var credentials = gconf ? gconf.credentials : null; - + if (!gconf && list.editableList('length') === 0) { + // No existing global-config node and nothing in the list, + // so no need to do anything more + return + } if (!credentials) { credentials = { _ : {}, @@ -78,6 +82,12 @@ RED.envVar = (function() { if (gconf === null) { gconf = getGlobalConf(true); } + if (!gconf.credentials) { + gconf.credentials = { + _ : {}, + map: {} + }; + } if ((JSON.stringify(new_env) !== JSON.stringify(gconf.env)) || (JSON.stringify(credentials) !== JSON.stringify(gconf.credentials))) { gconf.env = new_env;