mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-16 05:50:13 +01:00
Fix possible null-dereference if RegExp does not match in MD038.
This commit is contained in:
parent
4f4dee162c
commit
7d6635b472
2 changed files with 5 additions and 1 deletions
|
|
@ -19,7 +19,7 @@ module.exports = {
|
||||||
inlineCodeSpansRe.lastIndex = 0;
|
inlineCodeSpansRe.lastIndex = 0;
|
||||||
}
|
}
|
||||||
const match = inlineCodeSpansRe.exec(parent.content);
|
const match = inlineCodeSpansRe.exec(parent.content);
|
||||||
const content = match[3];
|
const content = (match || [])[3];
|
||||||
const leftError = /^\s([^`]|$)/.test(content);
|
const leftError = /^\s([^`]|$)/.test(content);
|
||||||
const rightError = /[^`]\s$/.test(content);
|
const rightError = /[^`]\s$/.test(content);
|
||||||
if (leftError || rightError) {
|
if (leftError || rightError) {
|
||||||
|
|
|
||||||
4
test/backslashes-and-backticks.md
Normal file
4
test/backslashes-and-backticks.md
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
# Heading
|
||||||
|
|
||||||
|
\\`\\
|
||||||
|
\\`\\
|
||||||
Loading…
Add table
Add a link
Reference in a new issue