mirror of
https://git.deluge-torrent.org/deluge
synced 2025-08-13 11:48:40 +00:00
Fix possible division by zero crash
This commit is contained in:
parent
c1622b23aa
commit
1209663595
1 changed files with 4 additions and 1 deletions
|
@ -371,7 +371,10 @@ class Torrent:
|
||||||
file_progress = self.handle.file_progress()
|
file_progress = self.handle.file_progress()
|
||||||
ret = []
|
ret = []
|
||||||
for i,f in enumerate(self.files):
|
for i,f in enumerate(self.files):
|
||||||
ret.append(float(file_progress[i]) / float(f["size"]))
|
try:
|
||||||
|
ret.append(float(file_progress[i]) / float(f["size"]))
|
||||||
|
except ZeroDivisionError:
|
||||||
|
ret.append(0.0)
|
||||||
|
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue