Don't spew notices when building tag cloud if there is no popularity sum to divide by.

This commit is contained in:
Brion Vibber 2010-01-04 10:39:11 -08:00
parent 783a2e249b
commit 11d7365a15

View File

@ -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');