diff --git a/macosx/Torrent.m b/macosx/Torrent.m index f46e8941f..0e5e78d3c 100644 --- a/macosx/Torrent.m +++ b/macosx/Torrent.m @@ -1341,8 +1341,6 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80 index = (int)indexValue; } - free(piecesAvailablity); - //determine percentage finished and available int have, avail; if ([self progress] >= 1.0) @@ -1362,7 +1360,10 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80 float available = 0; for (i = 0; i < pieceCount; i++) - available += 1.0 - piecesFinished[i]; + { + if (piecesAvailablity[i] > 0) + available += 1.0 - piecesFinished[i]; + } have = rintf((float)MAX_PIECES * [self progress]); avail = rintf((float)MAX_PIECES * available / (float)pieceCount); @@ -1372,6 +1373,8 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80 free(piecesFinished); } + free(piecesAvailablity); + //first two lines: dark blue to show progression, green to show available p = (uint32_t *)bitmapData; for (i = 0; i < have; i++)