1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-24 16:52:39 +00:00

(trunk libT) #3912 "tr_torrentGetMetadataPercent() may return NaN" -- fixed.

This commit is contained in:
Jordan Lee 2011-01-19 00:20:26 +00:00
parent 8c36d86d4a
commit ba5172150a

View file

@ -358,7 +358,7 @@ tr_torrentGetMetadataPercent( const tr_torrent * tor )
ret = 1.0;
else {
const struct tr_incomplete_metadata * m = tor->incompleteMetadata;
if( m == NULL )
if( !m || !m->pieceCount )
ret = 0.0;
else
ret = (m->pieceCount - m->piecesNeededCount) / (double)m->pieceCount;