Skip to content

Commit 215f850

Browse files
committed
Don't count non-ascii chars into maxChar limit in CharacterMap
1 parent 256b4d3 commit 215f850

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/Markdig/Helpers/CharacterMap.cs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,22 @@ public CharacterMap(IEnumerable<KeyValuePair<char, T>> maps)
3535
{
3636
var openingChar = map.Key;
3737
charSet.Add(openingChar);
38-
maxChar = Math.Max(maxChar, openingChar);
38+
39+
if (openingChar < 128)
40+
{
41+
maxChar = Math.Max(maxChar, openingChar);
42+
}
43+
else
44+
{
45+
nonAsciiMap ??= new Dictionary<uint, T>();
46+
}
3947
}
4048

4149
OpeningCharacters = charSet.ToArray();
4250
Array.Sort(OpeningCharacters);
4351

4452
asciiMap = new T[maxChar + 1];
4553

46-
if (maxChar >= 128)
47-
nonAsciiMap = new Dictionary<uint, T>();
48-
4954
foreach (var state in maps)
5055
{
5156
char openingChar = state.Key;

0 commit comments

Comments
 (0)