1
0
mirror of https://github.com/interviewstreet/go-jira.git synced 2025-07-15 01:04:38 +02:00

Add missing check to roleService.Get

There was missing a check for requests with invalid ID.
Now it returns an error instead of an empty role.
This commit is contained in:
Matthias Weiss
2019-05-09 11:44:39 +02:00
committed by Wes McNamee
parent 889618d979
commit 0f45703c19

View File

@ -68,6 +68,9 @@ func (s *RoleService) Get(roleID int) (*Role, *Response, error) {
jerr := NewJiraError(resp, err) jerr := NewJiraError(resp, err)
return nil, resp, jerr return nil, resp, jerr
} }
if role.Self == "" {
return nil, resp, fmt.Errorf("No role with ID %d found", roleID)
}
return role, resp, err return role, resp, err
} }