fixup 493c1a65: missed some null checks and a return

This commit is contained in:
tophf 2017-11-28 22:45:11 +03:00
parent c4690a839f
commit fc0b1dc739

View File

@ -430,7 +430,7 @@ function showLinterErrorMessage(title, contents, popup) {
contents,
className: 'danger center lint-config',
buttons: [t('confirmOK')],
}).then(() => popup && popup.codebox.focus());
}).then(() => popup && popup.codebox && popup.codebox.focus());
}
function setupLinterPopup(config) {
@ -514,6 +514,7 @@ function setupLinterPopup(config) {
if (!json) {
showLinterErrorMessage(linter, t('linterJSONError'), popup);
cm.focus();
return;
}
linterConfig.findInvalidRules(json, linter).then(invalid => {
if (invalid.length) {
@ -536,9 +537,7 @@ function setupLinterPopup(config) {
function reset(event) {
event.preventDefault();
if (linterConfig.getName() !== linter) {
linterConfig.setLinter(linter);
}
cm.setValue(defaultConfig);
cm.focus();
updateButtonState();