Commit a03f318964bc5ffa8ef6d10fdc466cef84ecfe46
Exists in
master
and in
4 other branches
Merge pull request #2119 from erroric/fix_issue2118
issue #2118: fix undefined method for nil:NilClass exception
Showing
1 changed file
with
2 additions
and
2 deletions
Show diff stats
app/workers/post_receive.rb
@@ -7,8 +7,8 @@ class PostReceive | @@ -7,8 +7,8 @@ class PostReceive | ||
7 | 7 | ||
8 | # Ignore push from non-gitlab users | 8 | # Ignore push from non-gitlab users |
9 | user = if identifier.eql? Gitlab.config.gitolite_admin_key | 9 | user = if identifier.eql? Gitlab.config.gitolite_admin_key |
10 | - email = project.commit(newrev).author.email | ||
11 | - User.find_by_email(email) | 10 | + email = project.commit(newrev).author.email rescue nil |
11 | + User.find_by_email(email) if email | ||
12 | elsif /^[A-Z0-9._%a-z\-]+@(?:[A-Z0-9a-z\-]+\.)+[A-Za-z]{2,4}$/.match(identifier) | 12 | elsif /^[A-Z0-9._%a-z\-]+@(?:[A-Z0-9a-z\-]+\.)+[A-Za-z]{2,4}$/.match(identifier) |
13 | User.find_by_email(identifier) | 13 | User.find_by_email(identifier) |
14 | else | 14 | else |