cmd/torrent/main.go | 7 ++++++- diff --git a/cmd/torrent/main.go b/cmd/torrent/main.go index 358ef9edf7fe92df1554a9fffb6510bd8e4fbafe..f27e57247c38695928d8a3c1a0b3c157463b21e6 100644 --- a/cmd/torrent/main.go +++ b/cmd/torrent/main.go @@ -57,7 +57,12 @@ return t.Name() }) 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))