From 67aca61d0cbca604e48a69b1b8e8cd302cace3cb Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 4 Oct 2019 20:00:59 +0530 Subject: [PATCH] Avoid zero-div --- src/pyj/read_book/prefs/head_foot.pyj | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/pyj/read_book/prefs/head_foot.pyj b/src/pyj/read_book/prefs/head_foot.pyj index 6eae29f6fd..212e0c5f3a 100644 --- a/src/pyj/read_book/prefs/head_foot.pyj +++ b/src/pyj/read_book/prefs/head_foot.pyj @@ -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}'