From 02115965083687fb22779c361dc0b2a928850977 Mon Sep 17 00:00:00 2001 From: Gregory Soutade Date: Sun, 27 Oct 2024 09:17:53 +0100 Subject: [PATCH] Fix potential division by 0 --- display.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/display.py b/display.py index eff7b47..d3763d0 100644 --- a/display.py +++ b/display.py @@ -207,7 +207,7 @@ class DisplayHTMLBlockTable(DisplayHTMLBlock): self.insertCol(column_insertion, self.iwla._('Ratio'), u'iwla_hit') for (index, r) in enumerate(self.rows): val = r[column] and int(r[column]) or 0 - self.setCellValue(index, column_insertion, '%.1f%%' % (float(val*100)/float(total))) + self.setCellValue(index, column_insertion, '%.1f%%' % (total and float(val*100)/float(total) or 0)) def _filter(self, function, column, args): target_col = None