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