]> Sergey Matveev's repositories - btrtrc.git/commitdiff
Return no Files if Torrent Info isn't available
authorMatt Joiner <anacrolix@gmail.com>
Wed, 25 Feb 2015 03:51:56 +0000 (14:51 +1100)
committerMatt Joiner <anacrolix@gmail.com>
Wed, 25 Feb 2015 03:51:56 +0000 (14:51 +1100)
client.go

index 28ba233e14ab22a61a4959535c6787cdb02984bd..25b0317cdb86b895b94f74d00ac6f98e336b068e 100644 (file)
--- 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{