From 7b3e3cbad51dfa66fa7aa81bb74a93419c3a19c9 Mon Sep 17 00:00:00 2001 From: TJ Holowaychuk Date: Wed, 20 Aug 2014 13:28:34 -0700 Subject: [PATCH] add fn assertion to app.use(). Closes #337 --- lib/application.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/application.js b/lib/application.js index c59ab9d..9be3123 100644 --- a/lib/application.js +++ b/lib/application.js @@ -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;