Fix the unconditional access to an optional element
authorAlexander Ebert <ebert@woltlab.com>
Mon, 4 Jul 2022 11:04:37 +0000 (13:04 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Mon, 4 Jul 2022 11:04:37 +0000 (13:04 +0200)
See https://www.woltlab.com/community/thread/296182-js-fehler-beim-scrollen-in-mobiler-ansicht/

ts/WoltLabSuite/Core/Ui/Mobile.ts

index a796be806e65879422f567cc740f1903a6b5db66..2e589d4a77bbbc2844eecf7a3025e06de6588d6c 100644 (file)
@@ -226,7 +226,7 @@ function setupMobileSidebar(): void {
 }
 
 function closeDropdown(): void {
-  _dropdownMenu!.classList.remove("dropdownOpen");
+  _dropdownMenu?.classList.remove("dropdownOpen");
 }
 
 function toggleMobileNavigation(message: HTMLElement, quickOptions: HTMLElement, navigation: HTMLElement): void {