fix: CircularBuffer PushUnique with zero len
This commit is contained in:
parent
de663205ba
commit
330d3fe3aa
|
@ -51,7 +51,7 @@ func (b *CircularBuffer[T]) PushUnique(value T) bool {
|
|||
b.lock.Lock()
|
||||
defer b.lock.Unlock()
|
||||
|
||||
if slices.Contains(b.buffer, value) {
|
||||
if len(b.buffer) == 0 || slices.Contains(b.buffer, value) {
|
||||
return false
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue