#5407: In `tr_peerMgrGetDesiredAvailable()`, check if swarm is running (suggested by x190)

This commit is contained in:
Mike Gelfand 2015-12-31 14:33:02 +00:00
parent 7d30ad3ff6
commit de304e8a35
1 changed files with 3 additions and 8 deletions

View File

@ -2619,17 +2619,12 @@ tr_peerMgrGetDesiredAvailable (const tr_torrent * tor)
/* common shortcuts... */
if (!tor->isRunning || tor->isStopping)
return 0;
if (tr_torrentIsSeed (tor))
return 0;
if (!tr_torrentHasMetadata (tor))
if (!tor->isRunning || tor->isStopping ||
tr_torrentIsSeed (tor) || !tr_torrentHasMetadata (tor))
return 0;
s = tor->swarm;
if (s == NULL)
if (s == NULL || !s->isRunning)
return 0;
n = tr_ptrArraySize (&s->peers);