Skip to content

Commit

Permalink
Simplify control flow in Reader.Reset.
Browse files Browse the repository at this point in the history
  • Loading branch information
andybalholm committed Mar 1, 2021
1 parent 87d8f45 commit 47c0dba
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,9 @@ func NewReader(src io.Reader) *Reader {
func (r *Reader) Reset(src io.Reader) error {
decoderStateInit(r)
r.src = src
if r.buf != nil {
return nil
if r.buf == nil {
r.buf = make([]byte, readBufSize)
}
r.buf = make([]byte, readBufSize)
return nil
}

Expand Down

0 comments on commit 47c0dba

Please sign in to comment.