diff options
-rw-r--r-- | system/db/content.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/system/db/content.go b/system/db/content.go index 8058cad..f1969b5 100644 --- a/system/db/content.go +++ b/system/db/content.go @@ -228,6 +228,14 @@ func Query(namespace string, opts QueryOptions) [][]byte { end = start + opts.Count } + // bounds check on posts given the start & end count + if start > n { + start = n - opts.Count + } + if end > n { + end = n + } + i := 0 // count of num posts added cur := 0 // count of where cursor is switch opts.Order { |