Browse Source

HUE-6566 [frontend] Prevent JS error on empty URLs for open.link

Enrico Berti 8 years ago
parent
commit
70c37c4
1 changed files with 9 additions and 4 deletions
  1. 9 4
      desktop/core/src/desktop/templates/hue.mako

+ 9 - 4
desktop/core/src/desktop/templates/hue.mako

@@ -1036,10 +1036,15 @@ ${ smart_unicode(login_modal(request).content) | n,unicode }
         });
 
         huePubSub.subscribe('open.link', function (href) {
-          if (href.startsWith('/') && !href.startsWith('/hue')){
-            page('/hue' + href);
-          } else {
-            page(href);
+          if (href) {
+            if (href.startsWith('/') && !href.startsWith('/hue')){
+              page('/hue' + href);
+            } else {
+              page(href);
+            }
+          }
+          else {
+            console.warn('Received an open.link without href.')
           }
         });
       };