Skip to content

Commit b556ed0

Browse files
committed
Merge pull request #5 from liubin0329/master
bugfix: crash when no confirmed email.
2 parents 636fbd7 + 00e0b1f commit b556ed0

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/omniauth/strategies/bitbucket.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,9 @@ class Bitbucket < OmniAuth::Strategies::OAuth
3030
def raw_info
3131
@raw_info ||= begin
3232
ri = MultiJson.decode(access_token.get('/api/1.0/user').body)['user']
33-
email = (MultiJson.decode(access_token.get('/api/1.0/emails').body).find { |email| email['primary'] })['email']
34-
ri.merge('email' => email) if email
33+
email = MultiJson.decode(access_token.get('/api/1.0/emails').body).find { |email| email['primary'] }
34+
ri.merge!('email' => email['email']) if email
35+
ri
3536
end
3637
end
3738
end

0 commit comments

Comments
 (0)