1
0
mirror of https://github.com/interviewstreet/go-jira.git synced 2025-03-19 20:57:47 +02:00

Fixed possible panic if resp is nil

This commit is contained in:
Andy Grunwald 2016-04-23 15:23:15 +02:00
parent d719d18a20
commit 559b76c3ef

View File

@ -51,9 +51,12 @@ func (s *AuthenticationService) AcquireSessionCookie(username, password string)
session := new(Session)
resp, err := s.client.Do(req, session)
if resp.StatusCode != 200 || err != nil {
if err != nil {
return false, fmt.Errorf("Auth at JIRA instance failed (HTTP(S) request). %s", err)
}
if resp != nil && resp.StatusCode != 200 {
return false, fmt.Errorf("Auth at JIRA instance failed (HTTP(S) request). Status code: %d", resp.StatusCode)
}
s.client.session = session