diff --git a/resources/assets/javascripts/lib/sidebar.js b/resources/assets/javascripts/lib/sidebar.js
index 17362fa017c4eb400336ab018e1ff9cac82d40fc..eefd317beaf047ae706718323d3532787eb67248 100644
--- a/resources/assets/javascripts/lib/sidebar.js
+++ b/resources/assets/javascripts/lib/sidebar.js
@@ -2,11 +2,8 @@ const Sidebar = {
 
     place() {
         const header = document.getElementById('main-header');
-        const sidebar = document.getElementById('sidebar');
-        if (sidebar) {
-            sidebar.style.top =
-                header.offsetTop + header.offsetHeight + 'px';
-        }
+        document.getElementById('sidebar').style.top =
+            header.offsetTop + header.offsetHeight + 'px';
     },
 
     observeSidebar() {
@@ -19,11 +16,8 @@ const Sidebar = {
         /**
          * Observe if sidebar fits into viewport.
          */
-        const sidebar = document.getElementById('sidebar');
-        if (sidebar) {
-            const sObserver = new IntersectionObserver(STUDIP.Sidebar.fits, options);
-            sObserver.observe();
-        }
+        const sObserver = new IntersectionObserver(STUDIP.Sidebar.fits, options);
+        sObserver.observe(document.getElementById('sidebar'));
     },
 
     observeBody() {
@@ -93,20 +87,18 @@ const Sidebar = {
 
     footerVisible(entries, observer) {
         const sidebar = document.getElementById('sidebar');
-        if (sidebar) {
-            entries.forEach(entry => {
-                // Footer is visible on current page.
-                if (entry.isIntersecting) {
-                    if (sidebar.classList.contains('no-footer')) {
-                        sidebar.classList.remove('no-footer');
-                    }
-                } else {
-                    if (!sidebar.classList.contains('no-footer')) {
-                        sidebar.classList.add('no-footer');
-                    }
+        entries.forEach(entry => {
+            // Footer is visible on current page.
+            if (entry.isIntersecting) {
+                if (sidebar.classList.contains('no-footer')) {
+                    sidebar.classList.remove('no-footer');
                 }
-            });
-        }
+            } else {
+                if (!sidebar.classList.contains('no-footer')) {
+                    sidebar.classList.add('no-footer');
+                }
+            }
+        });
     }
 };