From: Matt Joiner Date: Mon, 12 Sep 2016 07:47:07 +0000 (+1000) Subject: cmd/torrent: Fix progress bar for zero-length torrents X-Git-Tag: v1.0.0~584 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=720450320629a4997394cf85c23e387960d517fd;p=btrtrc.git cmd/torrent: Fix progress bar for zero-length torrents --- diff --git a/cmd/torrent/main.go b/cmd/torrent/main.go index 358ef9ed..f27e5724 100644 --- a/cmd/torrent/main.go +++ b/cmd/torrent/main.go @@ -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))