From 1fab7653294ece3ccd1589cbea9c3b0c77d0f1e6 Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Wed, 20 Apr 2016 20:10:39 +1000 Subject: [PATCH] Change the behaviour of Torrent.Length with when info isn't available --- t.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) 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 -- 2.48.1