Changeset 13389


Ignore:
Timestamp:
Jul 14, 2012, 7:34:38 PM (9 years ago)
Author:
jordan
Message:

(trunk libT) #4969 "jsonrpc response to torrent-get emits malformed json" -- fixed.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/torrent.c

    r13362 r13389  
    11461146getVerifyProgress( const tr_torrent * tor )
    11471147{
    1148     tr_piece_index_t i, n;
    1149     tr_piece_index_t checked = 0;
    1150 
    1151     assert( tr_isTorrent( tor ) );
    1152 
    1153     for( i=0, n=tor->info.pieceCount; i!=n; ++i )
    1154         if( tor->info.pieces[i].timeChecked )
    1155             ++checked;
    1156 
    1157     return checked / (double)tor->info.pieceCount;
     1148    double d = 0;
     1149
     1150    assert( tr_isTorrent( tor ) );
     1151
     1152    if( tr_torrentHasMetadata( tor ) )
     1153    {
     1154        tr_piece_index_t i, n;
     1155        tr_piece_index_t checked = 0;
     1156
     1157        for( i=0, n=tor->info.pieceCount; i!=n; ++i )
     1158            if( tor->info.pieces[i].timeChecked )
     1159                ++checked;
     1160
     1161        d = checked / (double)tor->info.pieceCount;
     1162    }
     1163
     1164    return d;
    11581165}
    11591166
Note: See TracChangeset for help on using the changeset viewer.