Skip to content

Commit

Permalink
Check null-able variables before using them
Browse files Browse the repository at this point in the history
  • Loading branch information
kzys committed Aug 23, 2018
1 parent 917cdd2 commit 1f441a0
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/librustdoc/html/static/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -231,10 +231,9 @@
}

var elem = document.getElementById(hash);
if (elem && isHidden(elem.offsetParent)) {
if (elem && elem.offsetParent && isHidden(elem.offsetParent)) {
var h3 = elem.parentNode.previousSibling;

if (h3.tagName !== 'H3') {
if (h3 && h3.tagName !== 'H3') {
h3 = h3.previousSibling; // skip div.docblock
}

Expand Down

0 comments on commit 1f441a0

Please sign in to comment.