fix prevent crash from user migrated profiles

This commit is contained in:
Berkeley Martinez
2015-08-14 17:08:01 -07:00
parent 40ab7d2911
commit dfb85e4ba7

View File

@ -158,14 +158,14 @@ export default function(UserIdent) {
userChanged = true; userChanged = true;
} }
if (!(/github/).test(provider)) { if (!(/github/).test(provider) && profile) {
debug('setting social', provider, (/github/g).test(provider)); debug('setting social', provider, (/github/g).test(provider));
debug('profile username', profile.username); debug('profile username', profile.username);
user[provider] = profile.username; user[provider] = profile.username;
} }
// if user signed in with github refresh their info // 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"); debug("user isn't github cool or username from github is different");
setProfileFromGithub(user, profile, profile._json); setProfileFromGithub(user, profile, profile._json);
userChanged = true; userChanged = true;