Skip to content

Commit

Permalink
Guard more in color-modes.js (#38235)
Browse files Browse the repository at this point in the history
  • Loading branch information
XhmikosR authored Mar 14, 2023
1 parent 6a043d9 commit 474bf2a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions site/static/docs/5.3/assets/js/color-modes.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@

const showActiveTheme = (theme, focus = false) => {
const themeSwitcher = document.querySelector('#bd-theme')
const themeSwitcherText = document.querySelector('#bd-theme-text')

if (!themeSwitcher) {
if (!themeSwitcher || !themeSwitcherText) {
return
}

const themeSwitcherText = document.querySelector('#bd-theme-text')
const activeThemeIcon = document.querySelector('.theme-icon-active use')
const btnToActive = document.querySelector(`[data-bs-theme-value="${theme}"]`)
const svgOfActiveBtn = btnToActive.querySelector('svg use').getAttribute('href')
Expand Down

0 comments on commit 474bf2a

Please sign in to comment.