1
0
mirror of https://github.com/golang/go synced 2024-11-21 23:24:41 -07:00

net/http: Fix nil pointer dereference in error case.

R=golang-dev
CC=bradfitz, golang-dev
https://golang.org/cl/5598044
This commit is contained in:
Volker Dobler 2012-01-30 07:57:50 -08:00 committed by Brad Fitzpatrick
parent dcbc77d2cf
commit ed7a8f7159

View File

@ -275,7 +275,7 @@ func (c *Client) Post(url string, bodyType string, body io.Reader) (r *Response,
}
req.Header.Set("Content-Type", bodyType)
r, err = send(req, c.Transport)
if c.Jar != nil {
if err == nil && c.Jar != nil {
c.Jar.SetCookies(req.URL, r.Cookies())
}
return r, err