summaryrefslogtreecommitdiff
path: root/system/db/content.go
diff options
context:
space:
mode:
authorSteve Manuel <nilslice@gmail.com>2016-11-01 23:46:13 -0700
committerSteve Manuel <nilslice@gmail.com>2016-11-01 23:46:13 -0700
commit863e88194336a7baefbceb266f56d60d6a002da5 (patch)
tree31a916c205c7b56545bff1f7015309f0639215b5 /system/db/content.go
parent86f50433c08e74aa185e532ec8455bd61d343090 (diff)
do not allow return length longer than number of values in bucket
Diffstat (limited to 'system/db/content.go')
-rw-r--r--system/db/content.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/system/db/content.go b/system/db/content.go
index 84695cc..03e6a41 100644
--- a/system/db/content.go
+++ b/system/db/content.go
@@ -215,6 +215,7 @@ func Query(namespace string, opts QueryOptions) [][]byte {
store.View(func(tx *bolt.Tx) error {
b := tx.Bucket([]byte(namespace))
c := b.Cursor()
+ n := b.Stats().KeyN
i := 0 // count of num posts added
cur := 0 // count of where cursor is
@@ -226,7 +227,7 @@ func Query(namespace string, opts QueryOptions) [][]byte {
continue
}
- if i >= opts.Count {
+ if i >= opts.Count || cur > n {
break
}
@@ -241,7 +242,7 @@ func Query(namespace string, opts QueryOptions) [][]byte {
continue
}
- if i >= opts.Count {
+ if i >= opts.Count || cur > n {
break
}