Fix possible null-dereference if RegExp does not match in MD038.

This commit is contained in:
David Anson 2019-01-06 22:07:10 -08:00
parent 4f4dee162c
commit 7d6635b472
2 changed files with 5 additions and 1 deletions

View file

@ -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) {

View file

@ -0,0 +1,4 @@
# Heading
\\`\\
\\`\\