Fix bug: ReadByte return EOF when read success

This commit is contained in:
Tnze
2021-02-27 20:18:41 +08:00
parent a7bf3b683f
commit 260805c0b1

View File

@ -52,6 +52,9 @@ type reader struct {
func (r reader) ReadByte() (byte, error) {
var b [1]byte
_, err := r.Read(b[:])
return b[0], err
n, err := r.Read(b[:])
if n == 1 {
return b[0], nil
}
return 0, err
}