diff --git a/phpgwapi/js/jsapi/app_base.js b/phpgwapi/js/jsapi/app_base.js index 465b50ba5c..6ddbfb42cc 100644 --- a/phpgwapi/js/jsapi/app_base.js +++ b/phpgwapi/js/jsapi/app_base.js @@ -301,8 +301,8 @@ var AppJS = Class.extend( // need to install a favorite handler, as we switch original one off with .off() .on('click','li[data-id]', this, function(){ var href = jQuery('a[href^="javascript:"]', this).prop('href'); - var matches = href.match(/^javascript:([^\(]+)\((.*)?\);?$/); - if (matches.length > 1 && matches[2] !== undefined) + var matches = href ? href.match(/^javascript:([^\(]+)\((.*)?\);?$/) : null; + if (matches && matches.length > 1 && matches[2] !== undefined) { return self.setState.call(self, JSON.parse(matches[2])); } @@ -486,11 +486,7 @@ var AppJS = Class.extend( else { // Normal user - just save to preferences client side - self.egw.set_preference(self.appname,favorite_pref,{ - name: name.val(), - group: false, - state:self.favorite_popup.state - }); + self.egw.set_preference(self.appname,favorite_pref,favorite); } // Add to list immediately @@ -501,20 +497,13 @@ var AppJS = Class.extend( // Create new item var html = "