Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix timeRemaining issue #549

Closed
wants to merge 1 commit into from
Closed

Fix timeRemaining issue #549

wants to merge 1 commit into from

Conversation

@DiegoRBaquero
Copy link
Member

DiegoRBaquero commented Dec 30, 2015

When the swarm hasn't been created but the timeRemaining property is accessed, it causes an error.

When the swarm hasn't been created but the timeRemaining property is accessed, it causes an error.
@@ -97,7 +97,7 @@ function Torrent (torrentId, opts) {
Object.defineProperty(Torrent.prototype, 'timeRemaining', {
get: function () {
if (this.done) return 0
if (this.swarm.downloadSpeed() === 0) return Infinity
if (this.swarm === undefined || this.swarm.downloadSpeed() === 0) return Infinity

This comment has been minimized.

Copy link
@feross

feross Jan 1, 2016

Member

This would also fail if swarm is null. It's better to just to do:

if (!this.swarm || this.swarm.downloadSpeed() === 0) return Infinity
@feross

This comment has been minimized.

Copy link
Member

feross commented Jan 1, 2016

Released as 0.67.1.

feross added a commit that referenced this pull request Jan 1, 2016
@feross feross closed this Jan 1, 2016
@feross feross deleted the timeRemaining-fix branch Jan 1, 2016
@lock

This comment has been minimized.

Copy link

lock bot commented May 5, 2018

This thread has been automatically locked because it has not had recent activity. To discuss futher, please open a new issue.

@lock lock bot locked as resolved and limited conversation to collaborators May 5, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.