Skip to content

Commit 1f441a0

Browse files
committed
Check null-able variables before using them
1 parent 917cdd2 commit 1f441a0

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/librustdoc/html/static/main.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -231,10 +231,9 @@
231231
}
232232

233233
var elem = document.getElementById(hash);
234-
if (elem && isHidden(elem.offsetParent)) {
234+
if (elem && elem.offsetParent && isHidden(elem.offsetParent)) {
235235
var h3 = elem.parentNode.previousSibling;
236-
237-
if (h3.tagName !== 'H3') {
236+
if (h3 && h3.tagName !== 'H3') {
238237
h3 = h3.previousSibling; // skip div.docblock
239238
}
240239

0 commit comments

Comments
 (0)