From 474bf2aed1c03cf53e2d2c48b30c5e689dd9e6bc Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Tue, 14 Mar 2023 20:30:11 +0200 Subject: [PATCH] Guard more in color-modes.js (#38235) --- site/static/docs/5.3/assets/js/color-modes.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/site/static/docs/5.3/assets/js/color-modes.js b/site/static/docs/5.3/assets/js/color-modes.js index 4528ba36b8..541fcc21b5 100644 --- a/site/static/docs/5.3/assets/js/color-modes.js +++ b/site/static/docs/5.3/assets/js/color-modes.js @@ -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')