Skip to content

Commit f3eae89

Browse files
Fix invalid line number computation when clicking on something else than a line number
1 parent 5c780b9 commit f3eae89

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/librustdoc/html/static/js/source-script.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,10 @@ const handleSourceHighlight = (function() {
205205

206206
return ev => {
207207
let cur_line_id = parseInt(ev.target.id, 10);
208+
// It can happen when clicking not on a line number span.
209+
if (isNaN(cur_line_id)) {
210+
return;
211+
}
208212
ev.preventDefault();
209213

210214
if (ev.shiftKey && prev_line_id) {

0 commit comments

Comments
 (0)