Explorar o código

fix out of bounds error

Aneurin Barker Snook hai 11 meses
pai
achega
f93ef31f52
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      memory_iter.go

+ 1 - 1
memory_iter.go

@@ -79,7 +79,7 @@ func (i *MemoryIterator[T]) GetAllKeys() []string {
 }
 
 func (i *MemoryIterator[T]) Key() string {
-	if i.pos < 0 || i.pos > i.Count() || i.released {
+	if i.pos < 0 || i.pos >= i.Count() || i.released {
 		return ""
 	}
 	return i.k[i.pos]