Ignore:
Timestamp:
Jun 19, 2007, 12:08:06 AM (15 years ago)
Author:
livings124
Message:

avoid ridiculously rate divide-by-0

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/torrent.c

    r2152 r2159  
    664664{
    665665    const uint64_t c = tr_torrentFileBytesCompleted ( tor, fileIndex );
    666     return (double)c / tor->info.files[fileIndex].length;
     666    uint64_t length = tor->info.files[fileIndex].length;
     667   
     668    if( !length )
     669        return 1.0;
     670    return (double)c / length;
    667671}
    668672
Note: See TracChangeset for help on using the changeset viewer.