Skip to content

Commit

Permalink
fix(rule): fix thrown error
Browse files Browse the repository at this point in the history
  • Loading branch information
azu committed Aug 30, 2016
1 parent 695d973 commit 3ef65a7
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/textlint-rule-max-comma.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ module.exports = function(context, options = defaultOptions) {
const nodeWithoutCode = filter(node, (node) => {
return node.type !== Syntax.Code;
});
const texts = nodeWithoutCode.children ? nodeWithoutCode.children.map(child => {
if (!nodeWithoutCode) {
return;
}
const texts = Array.isArray(nodeWithoutCode.children) ? nodeWithoutCode.children.map(child => {
return getSource(child);
}) : [];
const text = texts.join("");
Expand Down

0 comments on commit 3ef65a7

Please sign in to comment.