From 720450320629a4997394cf85c23e387960d517fd Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Mon, 12 Sep 2016 17:47:07 +1000 Subject: [PATCH] cmd/torrent: Fix progress bar for zero-length torrents --- cmd/torrent/main.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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))