aboutsummaryrefslogtreecommitdiffstats
path: root/lib/iterator/index.go
diff options
context:
space:
mode:
Diffstat (limited to 'lib/iterator/index.go')
-rw-r--r--lib/iterator/index.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/iterator/index.go b/lib/iterator/index.go
index dd660052..5dad4fe4 100644
--- a/lib/iterator/index.go
+++ b/lib/iterator/index.go
@@ -21,6 +21,9 @@ func FixBounds(i, lower, upper int) int {
// WrapBounds will wrap the index i around its upper- or lower-bound if
// out-of-bound
func WrapBounds(i, lower, upper int) int {
+ if upper <= 0 {
+ return lower
+ }
switch {
case i > upper:
i = lower + (i-upper-1)%upper