- Progress calculation patch

This commit is contained in:
Christophe Dumez 2008-08-17 03:47:52 +00:00
parent ff26ea94f5
commit 1aedd97d4d
2 changed files with 3 additions and 1 deletions

View file

@ -57,6 +57,8 @@ float QTorrentHandle::progress() const {
Q_ASSERT(h.is_valid());
if(!h.status().total_wanted)
return 0.;
if (h.status().total_wanted_done == h.status().total_wanted)
return 1.;
float progress = (float)h.status().total_wanted_done/(float)h.status().total_wanted;
Q_ASSERT(progress >= 0. && progress <= 1.);
return progress;