Fix division by zero.

This commit is contained in:
James Cole
2017-08-21 08:44:04 +02:00
parent ff390fcb7c
commit 9f5c2b74eb

View File

@@ -339,7 +339,11 @@ class TagRepository implements TagRepositoryInterface
{
$amountDiff = $max - $min;
$diff = $range[1] - $range[0];
$step = 1;
if ($diff !== 0) {
$step = $amountDiff / $diff;
}
$extra = round($amount / $step);
return intval($range[0] + $extra);