From 91518511a79ad2f2d227baba7d45a68acb19a9af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Gr=C3=BCner?= <47506558+MegaRedHand@users.noreply.github.com> Date: Thu, 7 Nov 2024 16:59:29 -0300 Subject: [PATCH] fix: set length to unknown if set to -1 --- progressbar.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/progressbar.go b/progressbar.go index 251e583..b994d6d 100644 --- a/progressbar.go +++ b/progressbar.go @@ -849,7 +849,11 @@ func (p *ProgressBar) ChangeMax64(newMax int64) { p.config.useIECUnits) } - p.lengthKnown(newMax) + if newMax == -1 { + p.lengthUnknown() + } else { + p.lengthKnown(newMax) + } p.lock.Unlock() // so p.Add can lock p.Add(0) // re-render