Skip to content

Commit 7b76ca5

Browse files
authored
Merge pull request #164 from RichieSams/protect
fix: Protect RenderBlank() and IsFinished() with the lock
2 parents a61e639 + 31e9c17 commit 7b76ca5

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

progressbar.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -471,6 +471,9 @@ func (p *ProgressBar) String() string {
471471

472472
// RenderBlank renders the current bar state, you can use this to render a 0% state
473473
func (p *ProgressBar) RenderBlank() error {
474+
p.lock.Lock()
475+
defer p.lock.Unlock()
476+
474477
if p.config.invisible {
475478
return nil
476479
}
@@ -644,6 +647,9 @@ func (p *ProgressBar) ChangeMax64(newMax int64) {
644647

645648
// IsFinished returns true if progress bar is completed
646649
func (p *ProgressBar) IsFinished() bool {
650+
p.lock.Lock()
651+
defer p.lock.Unlock()
652+
647653
return p.state.finished
648654
}
649655

0 commit comments

Comments
 (0)