
Math.max(x / y, 0.5) will return infinite when y is 0. Fix that by using Math.min() which was the actual intent of the patch.
Math.max(x / y, 0.5) will return infinite when y is 0. Fix that by using Math.min() which was the actual intent of the patch.