mirror of
https://git.sr.ht/~phw/scotty
synced 2025-06-01 19:38:34 +02:00
Fix potential zero division error in iterProgress
This commit is contained in:
parent
a8ce2be5d7
commit
b7ce09041e
1 changed files with 1 additions and 1 deletions
|
@ -264,7 +264,7 @@ func iterProgress[T any](
|
||||||
autocomplete bool,
|
autocomplete bool,
|
||||||
) iter.Seq2[int, T] {
|
) iter.Seq2[int, T] {
|
||||||
// Report progress in 1% steps
|
// Report progress in 1% steps
|
||||||
steps := len(items) / 100
|
steps := max(len(items)/100, 1)
|
||||||
return func(yield func(int, T) bool) {
|
return func(yield func(int, T) bool) {
|
||||||
for i, item := range items {
|
for i, item := range items {
|
||||||
yield(i, item)
|
yield(i, item)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue