Skip to content

Commit a400193

Browse files
committed
fix(pkg/ring): return nil on inconsistent access to buffer rings elements
1 parent dbcfc21 commit a400193

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

pkg/ring/buffer.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ func (r *ringBuffer) Get(i uint64) interface{} {
4949
if i < r.head {
5050
return nil
5151
}
52+
if i >= r.tail {
53+
return nil
54+
}
5255
return r.data[i%r.size]
5356
}
5457

0 commit comments

Comments
 (0)