1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-23 08:13:27 +00:00

#5501 Zero-sized files not shown correctly

This commit is contained in:
Mitchell Livingston 2013-10-27 20:56:10 +00:00
parent 4ecbb29137
commit 3f2549e886

View file

@ -1407,6 +1407,11 @@ int trashDataFile(const char * filename)
if (!fFileStat) if (!fFileStat)
[self updateFileStat]; [self updateFileStat];
// #5501
if ([node size] == 0) {
return 1.0;
}
NSIndexSet * indexSet = [node indexes]; NSIndexSet * indexSet = [node indexes];
if ([indexSet count] == 1) if ([indexSet count] == 1)
@ -1416,7 +1421,6 @@ int trashDataFile(const char * filename)
for (NSInteger index = [indexSet firstIndex]; index != NSNotFound; index = [indexSet indexGreaterThanIndex: index]) for (NSInteger index = [indexSet firstIndex]; index != NSNotFound; index = [indexSet indexGreaterThanIndex: index])
have += fFileStat[index].bytesCompleted; have += fFileStat[index].bytesCompleted;
NSAssert([node size], @"directory in torrent file has size 0");
return (CGFloat)have / [node size]; return (CGFloat)have / [node size];
} }