-1 error
This commit is contained in:
parent
e0e5a72e90
commit
6b6ede656d
@ -77,6 +77,10 @@ func (rb *RingBuffer) ContainsItem(item string) bool {
|
||||
rb.mu.Lock()
|
||||
defer rb.mu.Unlock()
|
||||
|
||||
if rb.head == -1 {
|
||||
return false
|
||||
}
|
||||
|
||||
for i := 0; i < rb.size; i++ {
|
||||
index := (rb.head + i) % rb.size
|
||||
if rb.buffer[index] == item {
|
||||
@ -86,3 +90,4 @@ func (rb *RingBuffer) ContainsItem(item string) bool {
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user