diff --git a/lib/options/rule-indent.js b/lib/options/rule-indent.js index 5fb76171..470058d0 100644 --- a/lib/options/rule-indent.js +++ b/lib/options/rule-indent.js @@ -22,7 +22,7 @@ module.exports = { */ process: function(nodeType, node, level) { if (nodeType === 'block') { - if (node[0][0] !== 's') { + if (node[0] && node[0][0] !== 's') { node.unshift(['s', '']); } for (var i = 0; i < node.length; i++) { diff --git a/test/rule-indent.js b/test/rule-indent.js index 8c44f94a..3826a82d 100644 --- a/test/rule-indent.js +++ b/test/rule-indent.js @@ -49,4 +49,11 @@ describe('options/rule-indent', function() { 'a { /* foo */\n\tcolor:red; /* bar */\n\n\tbackground: #fff\n}\n' ); }); + it('Valid value should ignore empty blocks', function() { + comb.configure({ 'rule-indent': true }); + assert.equal( + comb.processString('a {}'), + 'a {}' + ); + }); });