Skip to content

Commit

Permalink
Test if ticker still exist before printing and flushing progress bar …
Browse files Browse the repository at this point in the history
…on tick.
  • Loading branch information
henvic committed May 24, 2016
1 parent 528664d commit a4d347a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions progress.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,12 @@ func (p *Progress) Listen() {
select {
case <-p.ticker.C:
p.mtx.RLock()
p.print()
p.lw.Flush()

if p.ticker != nil {
p.print()
p.lw.Flush()
}

p.mtx.RUnlock()
case <-p.tdone:
p.ticker.Stop()
Expand Down

0 comments on commit a4d347a

Please sign in to comment.