From 250121e1375ffc498691733e0a5904d104b0089e Mon Sep 17 00:00:00 2001 From: asbjorn grandt Date: Sun, 2 Feb 2014 00:55:34 +0100 Subject: [PATCH] Fix divide by zero error on chapters with no content. --- fanficdownloader/htmlheuristics.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fanficdownloader/htmlheuristics.py b/fanficdownloader/htmlheuristics.py index c16d5cc..52a78df 100644 --- a/fanficdownloader/htmlheuristics.py +++ b/fanficdownloader/htmlheuristics.py @@ -137,6 +137,9 @@ def replace_br_with_p(body): contentLinesSum += lineLen if lineLen > longestLineLength: longestLineLength = lineLen + + if contentLines == 0: + contentLines = 1 averageLineLength = contentLinesSum/contentLines