diff options
author | Florent Viard <fviard@lacie.com> | 2013-09-10 17:46:10 +0000 |
---|---|---|
committer | Florent Viard <fviard@lacie.com> | 2013-09-11 11:36:09 +0200 |
commit | 6f478c4de1e313ba7d6d3c104bc31808b861a390 (patch) | |
tree | b3914e6aca5ea7d290b53bdf81959187d9b7d2cd /src/static/js/pluginfw | |
parent | c4fcedbb8db59e01f2b3b8a4d15250a8bc231ce9 (diff) | |
download | etherpad-lite-6f478c4de1e313ba7d6d3c104bc31808b861a390.zip |
Fix to check if searchTerm is not "undefined" before trying to use it to filter search results.
Signed-off-by: Florent Viard <fviard@lacie.com>
Diffstat (limited to 'src/static/js/pluginfw')
-rw-r--r-- | src/static/js/pluginfw/installer.js | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/static/js/pluginfw/installer.js b/src/static/js/pluginfw/installer.js index 22e64350..b125a77c 100644 --- a/src/static/js/pluginfw/installer.js +++ b/src/static/js/pluginfw/installer.js @@ -79,10 +79,12 @@ exports.search = function(searchTerm, maxCacheAge, cb) { exports.getAvailablePlugins(maxCacheAge, function(er, results) { if(er) return cb && cb(er); var res = {}; - searchTerm = searchTerm.toLowerCase(); + if (searchTerm) + searchTerm = searchTerm.toLowerCase(); for (var pluginName in results) { // for every available plugin if (pluginName.indexOf(plugins.prefix) != 0) continue; // TODO: Also search in keywords here! - if(pluginName.indexOf(searchTerm) < 0 && results[pluginName].description.indexOf(searchTerm) < 0) continue; + + if(searchTerm && pluginName.indexOf(searchTerm) < 0 && results[pluginName].description.indexOf(searchTerm) < 0) continue; res[pluginName] = results[pluginName]; } cb && cb(null, res) |