Commit 301c0a63 authored by Aron Fischer's avatar Aron Fischer Committed by Felix Lange

swarm/storage: call size before seek-from-end (#3469)

parent 65f486ff
...@@ -483,8 +483,11 @@ func (s *LazyChunkReader) Seek(offset int64, whence int) (int64, error) { ...@@ -483,8 +483,11 @@ func (s *LazyChunkReader) Seek(offset int64, whence int) (int64, error) {
case 1: case 1:
offset += s.off offset += s.off
case 2: case 2:
if s.chunk == nil { if s.chunk == nil { //seek from the end requires rootchunk for size. call Size first
return 0, fmt.Errorf("seek from the end requires rootchunk for size. call Size first") _, err := s.Size(nil)
if err != nil {
return 0, fmt.Errorf("can't get size: %v", err)
}
} }
offset += s.chunk.Size offset += s.chunk.Size
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment