Fix possible crash in MD005/list-indent, reporting issue with MD029/ol-prefix.

This commit is contained in:
David Anson 2020-04-09 20:14:36 -07:00
parent 320acfd7cc
commit 678597485b
3 changed files with 14 additions and 8 deletions

View file

@ -51,12 +51,14 @@ module.exports = {
// Validate each list item marker
items.forEach((item) => {
const match = orderedListItemMarkerRe.exec(item.line);
addErrorDetailIf(onError, item.lineNumber,
String(current), !match || match[1],
"Style: " + listStyleExamples[listStyle], null,
rangeFromRegExp(item.line, listItemMarkerRe));
if (listStyle === "ordered") {
current++;
if (match) {
addErrorDetailIf(onError, item.lineNumber,
String(current), match[1],
"Style: " + listStyleExamples[listStyle], null,
rangeFromRegExp(item.line, listItemMarkerRe));
if (listStyle === "ordered") {
current++;
}
}
});
});