From 6e95274413d573abeb525201c0df21d47ba20b63 Mon Sep 17 00:00:00 2001 From: "D. HT. Yu" Date: Sun, 8 Dec 2019 17:34:24 +0800 Subject: [PATCH] fix if statement in `cmd/torrent/main.go` (#349) --- cmd/torrent/main.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cmd/torrent/main.go b/cmd/torrent/main.go index 0152a5e2..d188a0a5 100644 --- a/cmd/torrent/main.go +++ b/cmd/torrent/main.go @@ -100,7 +100,9 @@ func addTorrents(client *torrent.Client) error { return nil, xerrors.Errorf("error loading torrent file %q: %s\n", arg, err) } t, err := client.AddTorrent(metaInfo) - return nil, xerrors.Errorf("adding torrent: %w", err) + if err != nil { + return nil, xerrors.Errorf("adding torrent: %w", err) + } return t, nil } }()