From: Matt Joiner Date: Thu, 21 May 2020 02:17:10 +0000 (+1000) Subject: Fix panic closing torrent that failed to open storage X-Git-Tag: v1.16.0~20 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=c04f09ee4296d6404ff9b336c9c5b106f62dfad5;p=btrtrc.git Fix panic closing torrent that failed to open storage --- diff --git a/storage/wrappers.go b/storage/wrappers.go index da52c89f..97f52c00 100644 --- a/storage/wrappers.go +++ b/storage/wrappers.go @@ -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 {