From 559b76c3ef7055723dd7686b18122cc5a4cfc9ab Mon Sep 17 00:00:00 2001 From: Andy Grunwald Date: Sat, 23 Apr 2016 15:23:15 +0200 Subject: [PATCH] Fixed possible panic if resp is nil --- authentication.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/authentication.go b/authentication.go index d10cff3..057201a 100644 --- a/authentication.go +++ b/authentication.go @@ -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