Skip to content

Commit

Permalink
Add early return to mitigate potential runtime errors
Browse files Browse the repository at this point in the history
  • Loading branch information
ramram-mf committed Dec 17, 2024
1 parent 5fc1a7b commit bb3a974
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions source/js/components/nav/desktop-dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,11 @@ class NavDesktopDropdown extends Accordion {
}

scrollListener() {
const newTopOffset = document
.querySelector(".wide-screen-menu-container")
.getBoundingClientRect().bottom;
const wideScreenMenuContainer = document.querySelector(".wide-screen-menu-container");
if (!wideScreenMenuContainer) {
return;
}
const newTopOffset = wideScreenMenuContainer.getBoundingClientRect().bottom;
const currentTopOffset = parseFloat(
this.content.style.top.replace("px", "")
);
Expand Down

0 comments on commit bb3a974

Please sign in to comment.