summaryrefslogtreecommitdiff
path: root/src/torrent.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/torrent.c')
-rw-r--r--src/torrent.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/torrent.c b/src/torrent.c
index 0c83995..fbc5884 100644
--- a/src/torrent.c
+++ b/src/torrent.c
@@ -610,7 +610,11 @@ gint64 peerfrom_get_lpd(JsonObject * pf)
gdouble file_get_progress(gint64 length, gint64 completed)
{
if (length > 0) {
- return ((gdouble) completed / (gdouble) length) * 100.0;
+ gdouble progress = ((gdouble) completed / (gdouble) length) * 100.0;
+ if (progress > 100.0)
+ return 100.0;
+ else
+ return progress;
} else {
return 0.0;
}