summaryrefslogtreecommitdiff
path: root/src/static/js/pluginfw
diff options
context:
space:
mode:
authorFlorent Viard <fviard@lacie.com>2013-09-10 17:46:10 +0000
committerFlorent Viard <fviard@lacie.com>2013-09-11 11:36:09 +0200
commit6f478c4de1e313ba7d6d3c104bc31808b861a390 (patch)
treeb3914e6aca5ea7d290b53bdf81959187d9b7d2cd /src/static/js/pluginfw
parentc4fcedbb8db59e01f2b3b8a4d15250a8bc231ce9 (diff)
downloadetherpad-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.js6
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)