From 8edfbe3d8de3a7cbae28f5295f3f03287c3599cf Mon Sep 17 00:00:00 2001
From: Tim Zallmann <tzallmann@gitlab.com>
Date: Fri, 18 Jan 2019 09:51:07 +0100
Subject: [PATCH] Fixed problem when element in main menu is not there (specs)

---
 app/assets/javascripts/frequent_items/components/app.vue | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/app/assets/javascripts/frequent_items/components/app.vue b/app/assets/javascripts/frequent_items/components/app.vue
index 3b8f7ca9e07..968e255e1fc 100644
--- a/app/assets/javascripts/frequent_items/components/app.vue
+++ b/app/assets/javascripts/frequent_items/components/app.vue
@@ -49,7 +49,8 @@ export default {
     eventHub.$on(`${this.namespace}-dropdownOpen`, this.dropdownOpenHandler);
 
     // As we init it through requestIdleCallback it could be that the dropdown is already open
-    if (document.getElementById(`nav-${this.namespace}-dropdown`).classList.contains('show')) {
+    const namespaceDropdown = document.getElementById(`nav-${this.namespace}-dropdown`);
+    if (namespaceDropdown && namespaceDropdown.classList.contains('show')) {
       this.dropdownOpenHandler();
     }
   },
-- 
2.30.9