diff --git a/example/sort/main.go b/example/sort/main.go index f3b5386..449f1ca 100644 --- a/example/sort/main.go +++ b/example/sort/main.go @@ -35,7 +35,7 @@ } func percentage(total, current int64, ratio int) int { - if total <= 0 { + if total == 0 || current > total { return 0 } return int(float64(ratio) * float64(current) / float64(total))