#20694: Fixing TagCloud with no content items

Work Items: 20694
This commit is contained in:
Sebastien Ros
2014-06-13 11:09:18 -07:00
parent e31aebff5a
commit 6eac97675e

View File

@@ -84,8 +84,8 @@ namespace Orchard.Tags.Services {
// initialize centroids with a linear distribution
var centroids = new int[buckets];
var maxCount = tagCounts.Max(tc => tc.Count);
var minCount = tagCounts.Min(tc => tc.Count);
var maxCount = tagCounts.Any() ? tagCounts.Max(tc => tc.Count) : 0;
var minCount = tagCounts.Any() ? tagCounts.Min(tc => tc.Count) : 0;
var maxDistance = maxCount - minCount;
for (int i = 0; i < centroids.Length; i++) {
centroids[i] = maxDistance/buckets * (i+1);