From 7d1c04164e26abc904a7e2ab8109a42f7621237e Mon Sep 17 00:00:00 2001 From: Nicolas Martin Date: Wed, 28 Oct 2020 12:11:12 +0100 Subject: [PATCH] Return the value of paginator.TotalPages in SetTotalPages... when the given number of items is below 1. --- paginator/paginator.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/paginator/paginator.go b/paginator/paginator.go index 7c0b0da..67ed2c9 100644 --- a/paginator/paginator.go +++ b/paginator/paginator.go @@ -40,8 +40,8 @@ type Model struct { // used for other things beyond navigating sets. Note that it both returns the // number of total pages and alters the model. func (m *Model) SetTotalPages(items int) int { - if items == 0 { - return 0 + if items < 1 { + return m.TotalPages } n := items / m.PerPage if items%m.PerPage > 0 {