From: Matt Joiner Date: Wed, 20 Apr 2016 10:10:39 +0000 (+1000) Subject: Change the behaviour of Torrent.Length with when info isn't available X-Git-Tag: v1.0.0~770 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=1fab7653294ece3ccd1589cbea9c3b0c77d0f1e6;p=btrtrc.git Change the behaviour of Torrent.Length with when info isn't available --- diff --git a/t.go b/t.go index 31515c53..eb292c91 100644 --- a/t.go +++ b/t.go @@ -104,12 +104,10 @@ func (t *Torrent) Name() string { // The completed length of all the torrent data, in all its files. This is // derived from the torrent info, when it is available. func (t *Torrent) Length() int64 { - select { - case <-t.GotInfo(): - return t.length - default: - return -1 + if t.info == nil { + panic("not valid until info obtained") } + return t.length } // Returns a run-time generated metainfo for the torrent that includes the