Skip to content

Commit

Permalink
patched reader error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
adranwit committed Oct 4, 2024
1 parent 735d07c commit 171a5f2
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions gs/reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,16 @@ func (t *reader) Read(dest []byte) (int, error) {
}
return err
}, t.storager)
if response.Body != nil {
defer response.Body.Close()
}
if err != nil {
return 0, err
}
if response == nil {
return 0, errors.New("response was empty")
}
if response.Body == nil {
return 0, errors.New("response body was empty")
}
defer response.Body.Close()
readSoFar := 0
for {
read, err := response.Body.Read(dest[readSoFar:])
Expand Down

0 comments on commit 171a5f2

Please sign in to comment.