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

This commit is contained in:
TJ Holowaychuk 2014-08-20 13:28:34 -07:00
parent 5fea250bcc
commit 7b3e3cbad5

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;