From fc0b1dc739ba4de594d9f23c463131738abfe5f5 Mon Sep 17 00:00:00 2001 From: tophf Date: Tue, 28 Nov 2017 22:45:11 +0300 Subject: [PATCH] fixup 493c1a65: missed some null checks and a return --- edit/lint.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/edit/lint.js b/edit/lint.js index fb90634c..ee35b94a 100644 --- a/edit/lint.js +++ b/edit/lint.js @@ -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); - } + linterConfig.setLinter(linter); cm.setValue(defaultConfig); cm.focus(); updateButtonState();