From 75485bcbd70f070d13e274ed2943d22d50881009 Mon Sep 17 00:00:00 2001 From: Dan Dumont Date: Fri, 9 Aug 2019 17:43:03 -0400 Subject: [PATCH] Allow multiple remove/add calls for a torrent object torrent object were created each time, even if torrentId was already a torrent. --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 135fb93c..1a9b6967 100644 --- a/index.js +++ b/index.js @@ -234,7 +234,7 @@ class WebTorrent extends EventEmitter { this._debug('add') opts = opts ? Object.assign({}, opts) : {} - const torrent = new Torrent(torrentId, this, opts) + const torrent = torrentId instanceof Torrent ? torrentId : new Torrent(torrentId, this, opts) this.torrents.push(torrent) torrent.once('_infoHash', onInfoHash)