From 3f037ef517603f698c001a8b4edcef44bf49d4cb Mon Sep 17 00:00:00 2001 From: Urban Rotnik Date: Wed, 17 Apr 2019 09:50:54 +0200 Subject: [PATCH] Fix navigationJS team switch when have only 1 team --- app/assets/javascripts/navigation.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/navigation.js b/app/assets/javascripts/navigation.js index 850a9c1cf..6be17746c 100644 --- a/app/assets/javascripts/navigation.js +++ b/app/assets/javascripts/navigation.js @@ -89,7 +89,12 @@ var teamSwitch = $('#team-switch'); var dropDownMenu = teamSwitch.find('.dropdown-menu'); var dropDownHeight; - var ps = new PerfectScrollbar(teamSwitch.find('.team-container')[0], { scrollYMarginOffset: 5 }); + var teamContainter = teamSwitch.find('.team-container')[0]; + var ps; + + if (typeof teamContainter === 'undefined') return; + + ps = new PerfectScrollbar(teamContainter, { scrollYMarginOffset: 5 }); teamSwitch.click(() => { dropDownHeight = dropDownMenu.height(); if (teamSwitch.find('.new-team').length === 0) {