Fixed `UI/Mobile` failing if no sidebar is present
authorAlexander Ebert <ebert@woltlab.com>
Wed, 24 Jun 2015 17:23:16 +0000 (19:23 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Wed, 24 Jun 2015 17:23:16 +0000 (19:23 +0200)
wcfsetup/install/files/js/WoltLab/WCF/UI/Mobile.js

index 76de64c0ebe22dbb19e68ee5e2517db341932209..288a827221cf9feec210249a5de273caca909164 100644 (file)
@@ -44,7 +44,7 @@ define(
                                deferSetup: true
                        });
                        
-                       if (Environment.browser() === 'microsoft' && _sidebar.clientWidth > 305) {
+                       if (Environment.browser() === 'microsoft' && _sidebar !== null && _sidebar.clientWidth > 305) {
                                this._fixSidebarIE();
                        }
                },
@@ -68,6 +68,8 @@ define(
                },
                
                _fixSidebarIE: function() {
+                       if (_sidebar === null) return;
+                       
                        // sidebar is rarely broken on IE9/IE10
                        _sidebar.style.setProperty('display', 'none');
                        _sidebar.style.removeProperty('display');
@@ -83,6 +85,8 @@ define(
                },
                
                _initSidebarToggleButtons: function() {
+                       if (_sidebar === null) return;
+                       
                        var sidebarPosition = (_main.classList.contains('sidebarOrientationLeft')) ? 'Left' : '';
                        sidebarPosition = (sidebarPosition) ? sidebarPosition : (_main.classList.contains('sidebarOrientationRight') ? 'Right' : '');