Skip to content

Commit

Permalink
Return the value of paginator.TotalPages in SetTotalPages...
Browse files Browse the repository at this point in the history
when the given number of items is below 1.
  • Loading branch information
penguwin authored and meowgorithm committed Oct 28, 2020
1 parent 97020cd commit 7d1c041
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions paginator/paginator.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 7d1c041

Please sign in to comment.