From efa410dc279bff80f5ab6ffcbcc87279e3737908 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Rodr=C3=ADguez=20B?= Date: Tue, 8 Dec 2015 22:38:34 -0500 Subject: [PATCH 1/2] Initialize pieces on constructor Many prototype functions and properties use it and if it hasn't been initialized it will throw error as it's undefined. --- lib/torrent.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/torrent.js b/lib/torrent.js index b9dc705f..d594d347 100644 --- a/lib/torrent.js +++ b/lib/torrent.js @@ -81,8 +81,9 @@ function Torrent (torrentId, opts) { this.numBlockedPeers = 0 this.files = null this.done = false - + this._amInterested = false + this.pieces = [] this._selections = [] this._critical = [] From cf9e89f0e73e92c0c069f7acd99140d0bbde85fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Rodr=C3=ADguez=20B?= Date: Tue, 8 Dec 2015 22:42:29 -0500 Subject: [PATCH 2/2] Standard fix Remove space to match standard --- lib/torrent.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/torrent.js b/lib/torrent.js index d594d347..ccf77820 100644 --- a/lib/torrent.js +++ b/lib/torrent.js @@ -81,7 +81,7 @@ function Torrent (torrentId, opts) { this.numBlockedPeers = 0 this.files = null this.done = false - + this._amInterested = false this.pieces = [] this._selections = []