cmd/torrent: Fix progress bar for zero-length torrents

This commit is contained in:
Matt Joiner 2016-09-12 17:47:07 +10:00
parent d3963eedfd
commit 7204503206
1 changed files with 6 additions and 1 deletions

View File

@ -57,7 +57,12 @@ func torrentBar(t *torrent.Torrent) {
})
go func() {
<-t.GotInfo()
bar.Total = int(t.Info().TotalLength())
tl := int(t.Info().TotalLength())
if tl == 0 {
bar.Set(1)
return
}
bar.Total = tl
for {
bc := t.BytesCompleted()
bar.Set(int(bc))