From b995a9d3161da3f15a06bcfc63ae7edaa5a615dc Mon Sep 17 00:00:00 2001 From: tophf Date: Wed, 29 Nov 2017 13:21:31 +0300 Subject: [PATCH] usercssData.vars may be absent (e.g. in unsaved style) fixes #267 --- edit/codemirror-default.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/edit/codemirror-default.js b/edit/codemirror-default.js index 78627713..1a1700ac 100644 --- a/edit/codemirror-default.js +++ b/edit/codemirror-default.js @@ -191,10 +191,8 @@ CodeMirror.hint && (() => { string[start + 3] === '[' && string[pos - 3] === ']' && string[pos - 4] === ']') { - if (typeof editor !== 'undefined' && - Object.hasOwnProperty.call( - editor.getStyle().usercssData.vars, - string.slice(start + 4, pos - 4))) { + const vars = typeof editor !== 'undefined' && (editor.getStyle().usercssData || {}).vars; + if (vars && Object.hasOwnProperty.call(vars, string.slice(start + 4, pos - 4))) { token[0] = USO_VALID_VAR; } else { token[0] = USO_INVALID_VAR;