X-Git-Url: https://git.webkit.org/?p=WebKit-https.git;a=blobdiff_plain;f=Source%2FWebInspectorUI%2FTools%2FPrettyPrinting%2FCodeMirrorFormatters.js;h=840c0b3ee90bd1a694860938b2372412d3d7c355;hp=3d99cb64f2cbc7847210693f60f366b05960d6dc;hb=6d66460b5ab211c08b172dc9259d0b5b23304ad0;hpb=0d221fc0ab8a864a249431d584711d23a6d27e91 diff --git a/Source/WebInspectorUI/Tools/PrettyPrinting/CodeMirrorFormatters.js b/Source/WebInspectorUI/Tools/PrettyPrinting/CodeMirrorFormatters.js index 3d99cb64f2cb..840c0b3ee90b 100644 --- a/Source/WebInspectorUI/Tools/PrettyPrinting/CodeMirrorFormatters.js +++ b/Source/WebInspectorUI/Tools/PrettyPrinting/CodeMirrorFormatters.js @@ -337,7 +337,7 @@ CodeMirror.extendMode("css", { if (content === ";") return 1; if (content === ",") { // "a,b,c,...,z{}" rule list at top level or in @media top level and only if the line length will be large. - if ((!state.stack.length || state.stack.lastValue === "@media{") && state._cssPrettyPrint.lineLength > 60) { + if ((!state.stack || !state.stack.length || state.stack.lastValue === "@media{") && state._cssPrettyPrint.lineLength > 60) { state._cssPrettyPrint.lineLength = 0; return 1; } @@ -395,7 +395,7 @@ CodeMirror.extendMode("css", { // In order insert newlines in selector lists we need keep track of the length of the current line. // This isn't exact line length, only the builder knows that, but it is good enough to get an idea. // If we are at a top level, keep track of the current line length, otherwise we reset to 0. - if (!state.stack.length || state.stack.lastValue === "@media{") + if (!state.stack || !state.stack.length || state.stack.lastValue === "@media{") state._cssPrettyPrint.lineLength += content.length; else state._cssPrettyPrint.lineLength = 0;