Don't toggle drawer if elements not found
| @@ -2157,6 +2157,11 @@ export function toggleDrawer(drawer, expand = true) { | ||
| 2157 | 2157 | /** @type {HTMLElement} */ |
| 2158 | 2158 | const content = drawer.querySelector(':scope > .inline-drawer-content'); |
| 2159 | 2159 | |
| 2160 | + if (!icon || !content) { | |
| 2161 | + console.debug('toggleDrawer: No icon or content found in the drawer element.'); | |
| 2162 | + return; | |
| 2163 | + } | |
| 2164 | + | |
| 2160 | 2165 | if (expand) { |
| 2161 | 2166 | icon.classList.remove('down', 'fa-circle-chevron-down'); |
| 2162 | 2167 | icon.classList.add('up', 'fa-circle-chevron-up'); |