mirror of
https://git.deluge-torrent.org/deluge
synced 2025-08-08 09:28:41 +00:00
Fix division by zero error in get_ratio
This commit is contained in:
parent
26c607ff66
commit
c1f977a2d1
1 changed files with 4 additions and 1 deletions
|
@ -420,8 +420,11 @@ class Torrent:
|
||||||
|
|
||||||
downloaded = status.all_time_download
|
downloaded = status.all_time_download
|
||||||
# We use 'total_done' if the downloaded value is 0
|
# We use 'total_done' if the downloaded value is 0
|
||||||
if downloaded == 0:
|
if downloaded == 0 and status.total_done > 0:
|
||||||
downloaded = status.total_done
|
downloaded = status.total_done
|
||||||
|
else:
|
||||||
|
# Return -1.0 to signify infinity
|
||||||
|
return -1.0
|
||||||
|
|
||||||
return float(status.all_time_upload) / float(downloaded)
|
return float(status.all_time_upload) / float(downloaded)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue