Skip to content

Commit

Permalink
Fix: vars could be undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
eight04 committed Sep 25, 2018
1 parent a7cfeb2 commit 29b8f51
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions edit/codemirror-default.js
Expand Up @@ -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},
Expand Down
2 changes: 1 addition & 1 deletion manage/manage.js
Expand Up @@ -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;
Expand Down

0 comments on commit 29b8f51

Please sign in to comment.