add fn assertion to app.use(). Closes #337

master
TJ Holowaychuk 2014-08-20 13:28:34 -07:00
parent 5fea250bcc
commit 7b3e3cbad5
1 changed files with 1 additions and 1 deletions

View File

@ -96,7 +96,7 @@ app.toJSON = function(){
*/
app.use = function(fn){
assert('GeneratorFunction' == fn.constructor.name, 'app.use() requires a generator function');
assert(fn && 'GeneratorFunction' == fn.constructor.name, 'app.use() requires a generator function');
debug('use %s', fn._name || fn.name || '-');
this.middleware.push(fn);
return this;