]> Sergey Matveev's repositories - btrtrc.git/commitdiff
Fix panic closing torrent that failed to open storage
authorMatt Joiner <anacrolix@gmail.com>
Thu, 21 May 2020 02:17:10 +0000 (12:17 +1000)
committerMatt Joiner <anacrolix@gmail.com>
Thu, 21 May 2020 02:17:10 +0000 (12:17 +1000)
storage/wrappers.go

index da52c89f37a8fe354d530e815e29e7bebde68cbb..97f52c00ddfdf352f1b302860541001b52a9930f 100644 (file)
@@ -19,7 +19,10 @@ func NewClient(cl ClientImpl) *Client {
 
 func (cl Client) OpenTorrent(info *metainfo.Info, infoHash metainfo.Hash) (*Torrent, error) {
        t, err := cl.ci.OpenTorrent(info, infoHash)
-       return &Torrent{t}, err
+       if err != nil {
+               return nil, err
+       }
+       return &Torrent{t}, nil
 }
 
 type Torrent struct {