diff --git a/lib/gitlab/git_access.rb b/lib/gitlab/git_access.rb
index ad2da2b81cf23516e77b3e87910df6b5b1c7a2fe..6cb4123987151b56020fed7f3e7c7f953bc5c843 100644
--- a/lib/gitlab/git_access.rb
+++ b/lib/gitlab/git_access.rb
@@ -128,7 +128,7 @@ module Gitlab
       action =
         if project.protected_branch?(branch_name(ref))
           protected_branch_action(oldrev, newrev, branch_name(ref))
-        elsif protected_tag?(tag_name(ref))
+        elsif (tag_ref = tag_name(ref)) && protected_tag?(tag_ref)
           # Prevent any changes to existing git tag unless user has permissions
           :admin_project
         else