Mercurial > lbo > hg > clusterconsensus
changeset 16:2cb083f1e2c4
Make safer use of ByteBuffers
author | Lewin Bormann <lbo@spheniscida.de> |
---|---|
date | Sat, 08 Oct 2016 13:16:15 +0200 |
parents | ae3f85363b5d |
children | 8ef859976bae |
files | http/http.go |
diffstat | 1 files changed, 2 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/http/http.go Sat Oct 08 13:16:01 2016 +0200 +++ b/http/http.go Sat Oct 08 13:16:15 2016 +0200 @@ -62,10 +62,10 @@ return con.NewError(con.ERR_CALL, fmt.Sprintf("Received HTTP code %d", response.StatusCode), err) } - blob := bytes.NewBuffer(nil) + blob := bytes.Buffer{} _, err = blob.ReadFrom(response.Body) - if err != nil { + if err != nil || blob.Bytes() == nil { return con.NewError(con.ERR_IO, "Couldn't read from body", err) }