Return correct next state from Read

This commit is contained in:
Brandon Dyck 2024-09-27 09:39:20 -06:00
parent e6debbd7dc
commit 776b513c44

View File

@ -127,8 +127,8 @@ type State[In any] struct {
func (s State[In]) Read(dst []In) (n uint64, next State[In], err error) {
nread, err := s.r.ReadAt(dst, int64(s.pos))
if n > 0 {
s.pos += uint64(n)
if nread > 0 {
s.pos += uint64(nread)
}
return uint64(nread), s, err
}