summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Ehlers <danielehlers@mindeye.net>2011-02-06 20:41:21 +0100
committerDaniel Ehlers <danielehlers@mindeye.net>2011-02-06 20:41:21 +0100
commit6d81544fb3047914f8eea5245492daecd3b36c53 (patch)
treedbc51afa3e6018eedf841dd306d6ba4890c063b0
parent7348e1c0586315de983656c01632759866b4d07a (diff)
downloadhakyll-6d81544fb3047914f8eea5245492daecd3b36c53.tar.gz
Fix possible division by zero.
When 'maxCount' and 'minCount' are equal then 'relative' will return NaN. Which result in font-size 0 on all tags in the tag cloud.
-rw-r--r--src/Text/Hakyll/Tags.hs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/Text/Hakyll/Tags.hs b/src/Text/Hakyll/Tags.hs
index a4559ca..d427aa5 100644
--- a/src/Text/Hakyll/Tags.hs
+++ b/src/Text/Hakyll/Tags.hs
@@ -149,7 +149,7 @@ renderTagCloud urlFunction minSize maxSize = createHakyllAction renderTagCloud'
minCount = minimum . map snd . tagCount
maxCount = maximum . map snd . tagCount
relative tagMap count = (count - minCount tagMap) /
- (maxCount tagMap - minCount tagMap)
+ (1 + maxCount tagMap - minCount tagMap)
tagCount = map (second $ fromIntegral . length) . M.toList