Don't toggle drawer if elements not found

732ca6c4e0ea72862034c3738af8ec6117495042

Cohee <18619528+Cohee1207@users.noreply.github.com>

1 files changed, +5 -0Ignore whitespace
public/scripts/utils.js+5 -0
@@ -2157,6 +2157,11 @@ export function toggleDrawer(drawer, expand = true) {
21572157 /** @type {HTMLElement} */
21582158 const content = drawer.querySelector(':scope > .inline-drawer-content');
21592159
2160+ if (!icon || !content) {
2161+ console.debug('toggleDrawer: No icon or content found in the drawer element.');
2162+ return;
2163+ }
2164+
21602165 if (expand) {
21612166 icon.classList.remove('down', 'fa-circle-chevron-down');
21622167 icon.classList.add('up', 'fa-circle-chevron-up');