Skip to content

Commit

Permalink
Add nil checks for user and group retrieval in GitLab host model
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew committed Jan 8, 2025
1 parent 9a1bb65 commit 3504107
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/models/hosts/gitlab.rb
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ def fetch_owner(login)
user = search.first.to_hash
id = user["id"]
user_hash = api_client.user(id).to_hash

return nil if user_hash.nil?
{
uuid: "user-#{user_hash["id"]}",
login: user_hash["username"],
Expand All @@ -342,6 +342,7 @@ def fetch_owner(login)
}
else
group = api_client.group(login, with_projects: false)
return nil if group.nil?
{
uuid: "organization-#{group["id"]}",
login: group["path"],
Expand Down

0 comments on commit 3504107

Please sign in to comment.