Skip to content

Commit 68253c2

Browse files
committed
be more defensive when matching for section highlight
1 parent ec2224d commit 68253c2

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/scripts/page.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ dw_page = {
2626
*/
2727
.each(function () {
2828
let $tgt = jQuery(this).parent();
29-
const nr = $tgt.attr('class').match(/(\s+|^)editbutton_(\d+)(\s+|$)/)[2];
29+
const match = $tgt.attr('class').match(/(\s+|^)editbutton_(\d+)(\s+|$)/);
30+
if(!match) return;
31+
const nr = match[2];
3032
let $highlight = jQuery(); // holder for elements in the section to be highlighted
3133
const $highlightWrap = jQuery('<div class="section_highlight_wrapper"></div>');
3234

0 commit comments

Comments
 (0)