Merge pull request #2193 from kpn3m000/develop

Fixes exception on search (plugins without description)
This commit is contained in:
John McLear 2014-07-03 19:03:39 +01:00
commit 03ead389ba

View file

@ -84,7 +84,14 @@ exports.search = function(searchTerm, maxCacheAge, cb) {
for (var pluginName in results) { // for every available plugin
if (pluginName.indexOf(plugins.prefix) != 0) continue; // TODO: Also search in keywords here!
if(searchTerm && !~pluginName.toLowerCase().indexOf(searchTerm) && !~results[pluginName].description.toLowerCase().indexOf(searchTerm)) continue;
if(searchTerm && !~results[pluginName].name.toLowerCase().indexOf(searchTerm)
&& (typeof results[pluginName].description != "undefined" && !~results[pluginName].description.toLowerCase().indexOf(searchTerm) )
){
if(typeof results[pluginName].description === "undefined"){
console.debug('plugin without Description: %s', results[pluginName].name);
}
continue;
}
res[pluginName] = results[pluginName];
}
cb && cb(null, res)