From dd05955a38b34bb2422b2c492e111d999815e2a4 Mon Sep 17 00:00:00 2001 From: tophf Date: Mon, 4 Dec 2017 20:12:47 +0300 Subject: [PATCH] fixup d97337de: preceding comment may be absent --- js/moz-parser.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/js/moz-parser.js b/js/moz-parser.js index bf023fdc..1aa2aa47 100644 --- a/js/moz-parser.js +++ b/js/moz-parser.js @@ -23,10 +23,11 @@ var mozParser = (() => { const section = {code: '', start: {line, col}}; // move last comment before @-moz-document inside the section if (!/\/\*[\s\n]*AGENT_SHEET[\s\n]*\*\//.test(lastCmt)) { - section.code = lastCmt + '\n'; - const indent = outerText.match(/^\s*/)[0]; - outerText = outerText.slice(0, -lastCmt.length); - outerText = indent + outerText.trim(); + if (lastCmt) { + section.code = lastCmt + '\n'; + outerText = outerText.slice(0, -lastCmt.length); + } + outerText = outerText.match(/^\s*/)[0] + outerText.trim(); } if (outerText.trim()) { lastSection.code = outerText;