Skip to content

Commit 3ef65a7

Browse files
committed
fix(rule): fix thrown error
1 parent 695d973 commit 3ef65a7

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/textlint-rule-max-comma.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@ module.exports = function(context, options = defaultOptions) {
1717
const nodeWithoutCode = filter(node, (node) => {
1818
return node.type !== Syntax.Code;
1919
});
20-
const texts = nodeWithoutCode.children ? nodeWithoutCode.children.map(child => {
20+
if (!nodeWithoutCode) {
21+
return;
22+
}
23+
const texts = Array.isArray(nodeWithoutCode.children) ? nodeWithoutCode.children.map(child => {
2124
return getSource(child);
2225
}) : [];
2326
const text = texts.join("");

0 commit comments

Comments
 (0)