mirror of
https://github.com/transmission/transmission
synced 2024-12-24 16:52:39 +00:00
avoid ridiculously rate divide-by-0
This commit is contained in:
parent
48c44109c9
commit
a4d5dfa328
2 changed files with 7 additions and 3 deletions
|
@ -663,7 +663,11 @@ float
|
|||
tr_torrentFileCompletion ( const tr_torrent_t * tor, int fileIndex )
|
||||
{
|
||||
const uint64_t c = tr_torrentFileBytesCompleted ( tor, fileIndex );
|
||||
return (double)c / tor->info.files[fileIndex].length;
|
||||
uint64_t length = tor->info.files[fileIndex].length;
|
||||
|
||||
if( !length )
|
||||
return 1.0;
|
||||
return (double)c / length;
|
||||
}
|
||||
|
||||
float*
|
||||
|
|
|
@ -161,8 +161,8 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
|
|||
{
|
||||
fLib = tr_init("macosx");
|
||||
|
||||
fTorrents = [[NSMutableArray alloc] initWithCapacity: 10];
|
||||
fDisplayedTorrents = [[NSMutableArray alloc] initWithCapacity: 10];
|
||||
fTorrents = [[NSMutableArray alloc] init];
|
||||
fDisplayedTorrents = [[NSMutableArray alloc] init];
|
||||
fPendingTorrentDownloads = [[NSMutableDictionary alloc] init];
|
||||
|
||||
fDefaults = [NSUserDefaults standardUserDefaults];
|
||||
|
|
Loading…
Reference in a new issue