Changeset 2159


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

avoid ridiculously rate divide-by-0

Location:
trunk
Files:
2 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
  • trunk/macosx/Controller.m

    r2149 r2159  
    162162        fLib = tr_init("macosx");
    163163       
    164         fTorrents = [[NSMutableArray alloc] initWithCapacity: 10];
    165         fDisplayedTorrents = [[NSMutableArray alloc] initWithCapacity: 10];
     164        fTorrents = [[NSMutableArray alloc] init];
     165        fDisplayedTorrents = [[NSMutableArray alloc] init];
    166166        fPendingTorrentDownloads = [[NSMutableDictionary alloc] init];
    167167       
Note: See TracChangeset for help on using the changeset viewer.