usercssData.vars may be absent (e.g. in unsaved style)

fixes #267
This commit is contained in:
tophf 2017-11-29 13:21:31 +03:00
parent bf13383c93
commit b995a9d316

View File

@ -191,10 +191,8 @@ CodeMirror.hint && (() => {
string[start + 3] === '[' && string[start + 3] === '[' &&
string[pos - 3] === ']' && string[pos - 3] === ']' &&
string[pos - 4] === ']') { string[pos - 4] === ']') {
if (typeof editor !== 'undefined' && const vars = typeof editor !== 'undefined' && (editor.getStyle().usercssData || {}).vars;
Object.hasOwnProperty.call( if (vars && Object.hasOwnProperty.call(vars, string.slice(start + 4, pos - 4))) {
editor.getStyle().usercssData.vars,
string.slice(start + 4, pos - 4))) {
token[0] = USO_VALID_VAR; token[0] = USO_VALID_VAR;
} else { } else {
token[0] = USO_INVALID_VAR; token[0] = USO_INVALID_VAR;