Permalink
Browse files

check that cb is a function before registering it as callback

  • Loading branch information...
Floby committed Dec 23, 2012
1 parent 56bb8a5 commit aee2411148bdc6f80cb8fdd5967ffc30fdba2847
Showing with 3 additions and 1 deletion.
  1. +3 −1 lib/Search.js
View
@@ -58,7 +58,9 @@ Search.prototype.execute = function execute(cb) {
return self.emit('ready', self);
}
- this.once('ready', cb);
+ if(typeof cb == 'function') {
+ this.once('ready', cb);
+ }
};
Search.prototype._processResults = function _processResults(search) {

0 comments on commit aee2411

Please sign in to comment.