avoid index out of slice range

This commit is contained in:
chrislu 2023-01-14 13:31:22 -08:00
parent 313fd17ae4
commit 12f8251d32

View file

@ -208,7 +208,7 @@ func (s *SingleChunkCacher) readChunkAt(buf []byte, offset int64) (int, error) {
return 0, s.err return 0, s.err
} }
if len(s.data) == 0 { if len(s.data) <= int(offset) {
return 0, nil return 0, nil
} }