Fix issue with CodeInlineParser that was incrementing local line index even without matching, resulting in an exception IndexOutOfRange

This commit is contained in:
Alexandre Mutel
2016-06-08 16:08:01 +09:00
parent 987357ef5a
commit 795d002ed0

View File

@@ -47,13 +47,13 @@ namespace Markdig.Parsers.Inlines
// The contents of the code span are the characters between the two backtick strings, with leading and trailing spaces and line endings removed, and whitespace collapsed to single spaces.
var pc = ' ';
int newLinesFound = 0;
while (c != '\0')
{
// Transform '\n' into a single space
if (c == '\n')
{
processor.LocalLineIndex++;
processor.LineIndex++;
newLinesFound++;
c = ' ';
}
@@ -104,6 +104,9 @@ namespace Markdig.Parsers.Inlines
Content = builder.ToString()
};
isMatching = true;
processor.LocalLineIndex += newLinesFound;
processor.LineIndex += newLinesFound;
}
// Release the builder if not used