Skip to content

Commit d9e6bd6

Browse files
committed
Merge pull request #109 from csscomb/tg/93
Check if node exists (#93)
2 parents e554abc + b1da2a6 commit d9e6bd6

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

lib/options/rule-indent.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ module.exports = {
2222
*/
2323
process: function(nodeType, node, level) {
2424
if (nodeType === 'block') {
25-
if (node[0][0] !== 's') {
25+
if (node[0] && node[0][0] !== 's') {
2626
node.unshift(['s', '']);
2727
}
2828
for (var i = 0; i < node.length; i++) {

test/rule-indent.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,11 @@ describe('options/rule-indent', function() {
4949
'a { /* foo */\n\tcolor:red; /* bar */\n\n\tbackground: #fff\n}\n'
5050
);
5151
});
52+
it('Valid value should ignore empty blocks', function() {
53+
comb.configure({ 'rule-indent': true });
54+
assert.equal(
55+
comb.processString('a {}'),
56+
'a {}'
57+
);
58+
});
5259
});

0 commit comments

Comments
 (0)