From: Matt Joiner Date: Wed, 25 Feb 2015 03:51:56 +0000 (+1100) Subject: Return no Files if Torrent Info isn't available X-Git-Tag: v1.0.0~1318 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=48dc85bfd33f9e3636ea1c0d4399d58e2faf7806;p=btrtrc.git Return no Files if Torrent Info isn't available --- diff --git a/client.go b/client.go index 28ba233e..25b0317c 100644 --- a/client.go +++ b/client.go @@ -1710,6 +1710,11 @@ func (f *File) PrioritizeRegion(off, len int64) { // Returns handles to the files in the torrent. This requires the metainfo is // available first. func (t Torrent) Files() (ret []File) { + select { + case <-t.GotMetainfo: + default: + return + } var offset int64 for _, fi := range t.Info.UpvertedFiles() { ret = append(ret, File{