aboutsummaryrefslogtreecommitdiff
path: root/cursor.go
diff options
context:
space:
mode:
Diffstat (limited to 'cursor.go')
-rw-r--r--cursor.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/cursor.go b/cursor.go
index 244c915..d66f1c1 100644
--- a/cursor.go
+++ b/cursor.go
@@ -235,7 +235,7 @@ func (c *Cursor) nsearch(key []byte) {
// keyValue returns the key and value of the current leaf element.
func (c *Cursor) keyValue() ([]byte, []byte) {
ref := &c.stack[len(c.stack)-1]
- if ref.index >= ref.count() {
+ if ref.count() == 0 || ref.index >= ref.count() {
return nil, nil
}