From dfb85e4ba7582fdaa314e5438093c1f548988b3e Mon Sep 17 00:00:00 2001 From: Berkeley Martinez Date: Fri, 14 Aug 2015 17:08:01 -0700 Subject: [PATCH] fix prevent crash from user migrated profiles --- common/models/User-Identity.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/models/User-Identity.js b/common/models/User-Identity.js index 7aa88b295e..3b1bcb8750 100644 --- a/common/models/User-Identity.js +++ b/common/models/User-Identity.js @@ -158,14 +158,14 @@ export default function(UserIdent) { userChanged = true; } - if (!(/github/).test(provider)) { + if (!(/github/).test(provider) && profile) { debug('setting social', provider, (/github/g).test(provider)); debug('profile username', profile.username); user[provider] = profile.username; } // if user signed in with github refresh their info - if (/github/.test(provider)) { + if (/github/.test(provider) && profile && profile._json) { debug("user isn't github cool or username from github is different"); setProfileFromGithub(user, profile, profile._json); userChanged = true;