Avoid zero-div

This commit is contained in:
Kovid Goyal 2019-10-04 20:00:59 +05:30
parent 8ef6938e03
commit 67aca61d0c
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -128,6 +128,8 @@ def format_time_left(seconds):
def format_pos(progress_frac, length):
if length < 1:
return ''
pages = Math.ceil(length / 1000)
pos = progress_frac * pages
return f'{pos:.1f} / {pages}'