fix TypeError when profile without emails

This commit is contained in:
Jackson Tian 2015-11-23 12:24:28 +08:00
parent dd98208cd2
commit c652c28df1

View File

@ -19,7 +19,7 @@ exports.callback = function (req, res, next) {
user.githubAccessToken = profile.accessToken;
// user.loginname = profile.username;
user.avatar = profile._json.avatar_url;
if (profile.emails[0].value) {
if (profile.emails && profile.emails[0] && profile.emails[0].value) {
user.email = profile.emails[0].value;
}