From 16e264788a1e78ae52c8f7d9421b7a8ff5cb4a68 Mon Sep 17 00:00:00 2001 From: Nick Winter Date: Mon, 24 Nov 2014 14:23:54 -0800 Subject: [PATCH] Trying to workaround a crash I saw in the logs for GitHub auth. --- server/routes/github.coffee | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/server/routes/github.coffee b/server/routes/github.coffee index dbae56bb6..9887dae40 100644 --- a/server/routes/github.coffee +++ b/server/routes/github.coffee @@ -27,7 +27,10 @@ module.exports.setup = (app) -> request.get {uri: 'https://api.github.com/user', headers: headers}, (err, r, response) -> return log.error err if err? githubUser = JSON.parse response - emailLower = githubUser.email.toLowerCase() + log.info 'Got GitHub auth callback response', githubUser + emailLower = githubUser.email?.toLowerCase() + if not emailLower + return errors.serverError res, "Problem finding GitHub user with that identity." # GitHub users can change emails User.findOne {$or: [{emailLower: emailLower}, {githubID: githubUser.id}]}, (err, user) ->