From 11d7365a15bb8c8cb856bf0d545a0b550f3dbe26 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Mon, 4 Jan 2010 10:39:11 -0800 Subject: [PATCH] Don't spew notices when building tag cloud if there is no popularity sum to divide by. --- actions/publictagcloud.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/actions/publictagcloud.php b/actions/publictagcloud.php index e7f6ee36c7..5c70740290 100644 --- a/actions/publictagcloud.php +++ b/actions/publictagcloud.php @@ -136,7 +136,12 @@ class PublictagcloudAction extends Action $this->elementStart('dd'); $this->elementStart('ul', 'tags xoxo tag-cloud'); foreach ($tw as $tag => $weight) { - $this->showTag($tag, $weight, $weight/$sum); + if ($sum) { + $weightedSum = $weight/$sum; + } else { + $weightedSum = 1; + } + $this->showTag($tag, $weight, $weightedSum); } $this->elementEnd('ul'); $this->elementEnd('dd'); -- 2.39.2