Simplify control flow in Reader.Reset.

This commit is contained in:
Andy Balholm 2021-03-01 09:45:40 -08:00
parent 87d8f4575c
commit 47c0dbab12
1 changed files with 2 additions and 3 deletions

View File

@ -33,10 +33,9 @@ func NewReader(src io.Reader) *Reader {
func (r *Reader) Reset(src io.Reader) error { func (r *Reader) Reset(src io.Reader) error {
decoderStateInit(r) decoderStateInit(r)
r.src = src r.src = src
if r.buf != nil { if r.buf == nil {
return nil r.buf = make([]byte, readBufSize)
} }
r.buf = make([]byte, readBufSize)
return nil return nil
} }