Skip to content

Commit e0cd47f

Browse files
committed
Core: Don't thow an error if lookbehing is used without anything matching.
1 parent bdbdb7d commit e0cd47f

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

components/prism-core.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ var _ = _self.Prism = {
356356
}
357357

358358
if(lookbehind) {
359-
lookbehindLength = match[1].length;
359+
lookbehindLength = match[1] ? match[1].length : 0;
360360
}
361361

362362
var from = match.index + lookbehindLength,

components/prism-core.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

prism.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ var _ = _self.Prism = {
361361
}
362362

363363
if(lookbehind) {
364-
lookbehindLength = match[1].length;
364+
lookbehindLength = match[1] ? match[1].length : 0;
365365
}
366366

367367
var from = match.index + lookbehindLength,

0 commit comments

Comments
 (0)