From 7a925f15ba63a34a5118a87615befaf4c2ebdcc1 Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Wed, 16 Jul 2008 21:54:01 +0000 Subject: [PATCH] - Fixed a bug in torrent progress calculation (regression) --- src/qtorrenthandle.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/qtorrenthandle.cpp b/src/qtorrenthandle.cpp index 18ad2b061..edd3b8aef 100644 --- a/src/qtorrenthandle.cpp +++ b/src/qtorrenthandle.cpp @@ -55,7 +55,9 @@ QString QTorrentHandle::name() const { float QTorrentHandle::progress() const { Q_ASSERT(h.is_valid()); - float progress = h.status().progress; + if(!h.status().total_wanted) + return 0.; + float progress = (float)h.status().total_wanted_done/(float)h.status().total_wanted; Q_ASSERT(progress >= 0. && progress <= 1.); return progress; }