Skip to content

Commit

Permalink
Add missing check to roleService.Get
Browse files Browse the repository at this point in the history
There was missing a check for requests with invalid ID.
Now it returns an error instead of an empty role.
  • Loading branch information
Matthias Weiss authored and ghostsquad committed May 14, 2019
1 parent 889618d commit 0f45703
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions role.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ func (s *RoleService) Get(roleID int) (*Role, *Response, error) {
jerr := NewJiraError(resp, err)
return nil, resp, jerr
}
if role.Self == "" {
return nil, resp, fmt.Errorf("No role with ID %d found", roleID)
}

return role, resp, err
}

0 comments on commit 0f45703

Please sign in to comment.