diff --git a/edit/codemirror-default.js b/edit/codemirror-default.js index 0912f445..74fc2942 100644 --- a/edit/codemirror-default.js +++ b/edit/codemirror-default.js @@ -371,8 +371,11 @@ CodeMirror.hint && (() => { } // USO vars in usercss mode editor - const list = Object.keys(editor.getStyle().usercssData.vars) - .filter(name => name.startsWith(leftPart)); + const vars = editor.getStyle().usercssData.vars; + const list = vars ? + Object.keys(editor.getStyle().usercssData.vars) + .filter(name => name.startsWith(leftPart)) : + []; return { list, from: {line, ch: prev}, diff --git a/manage/manage.js b/manage/manage.js index 01b005f8..e9a8dd56 100644 --- a/manage/manage.js +++ b/manage/manage.js @@ -195,7 +195,7 @@ function createStyleElement({style, name}) { }; } const parts = createStyleElement.parts; - const configurable = style.usercssData && Object.keys(style.usercssData.vars).length > 0; + const configurable = style.usercssData && style.usercssData.vars && Object.keys(style.usercssData.vars).length > 0; parts.checker.checked = style.enabled; parts.nameLink.textContent = tWordBreak(style.name); parts.nameLink.href = parts.editLink.href = parts.editHrefBase + style.id;