Skip to content

Commit

Permalink
Fix: index out of range getting non stored version
Browse files Browse the repository at this point in the history
  • Loading branch information
gdiazlo committed Mar 8, 2019
1 parent 7aa821a commit d172e13
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tests/e2e/test_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,9 @@ func (s *snapStore) Get(version uint64) *protocol.SignedSnapshot {
s.Lock()
defer s.Unlock()
targetSegment := version / segmentSize
if targetSegment > uint64(len(s.segments)) {
return nil
}
targetIndex := version - (targetSegment * segmentSize)
return s.segments[targetSegment][targetIndex]
}
Expand Down

0 comments on commit d172e13

Please sign in to comment.