diff --git a/progress.go b/progress.go index 58d2140..f9c3c28 100644 --- a/progress.go +++ b/progress.go @@ -209,7 +209,7 @@ close(trs.bar.shutdown) } if r.toRemove { - heap.Remove(s.bHeap, trs.bar.index) + s.heapUpdated = heap.Remove(s.bHeap, trs.bar.index) != nil } } @@ -237,13 +237,15 @@ } func calcMax(slice []int) int { + if len(slice) == 0 { + return 0 + } + max := slice[0] - for i := 1; i < len(slice); i++ { if slice[i] > max { max = slice[i] } } - return max }