From 3f2549e8863b7a8121ebf0acb75d383694b9d763 Mon Sep 17 00:00:00 2001 From: Mitchell Livingston Date: Sun, 27 Oct 2013 20:56:10 +0000 Subject: [PATCH] #5501 Zero-sized files not shown correctly --- macosx/Torrent.m | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/macosx/Torrent.m b/macosx/Torrent.m index 660c5a6dd..f6dbd935a 100644 --- a/macosx/Torrent.m +++ b/macosx/Torrent.m @@ -1407,6 +1407,11 @@ int trashDataFile(const char * filename) if (!fFileStat) [self updateFileStat]; + // #5501 + if ([node size] == 0) { + return 1.0; + } + NSIndexSet * indexSet = [node indexes]; if ([indexSet count] == 1) @@ -1416,7 +1421,6 @@ int trashDataFile(const char * filename) for (NSInteger index = [indexSet firstIndex]; index != NSNotFound; index = [indexSet indexGreaterThanIndex: index]) have += fFileStat[index].bytesCompleted; - NSAssert([node size], @"directory in torrent file has size 0"); return (CGFloat)have / [node size]; }