更改NAN bug

This commit is contained in:
liushaofeng
2020-06-24 11:27:45 +08:00
parent 789138beed
commit c3ea78efa1
@@ -182,7 +182,8 @@ public class SliderCaptchaTemplate {
* @return true 成功 false 失败
*/
public boolean percentageContrast(Float newPercentage, Float oriPercentage) {
if (newPercentage == null || Float.isNaN(newPercentage) || oriPercentage == null || Float.isNaN(oriPercentage)) {
if (newPercentage == null || Float.isNaN(newPercentage) || Float.isInfinite(newPercentage)
|| oriPercentage == null || Float.isNaN(oriPercentage) || Float.isInfinite(oriPercentage)) {
return false;
}
BigDecimal num = BigDecimal.valueOf(0.02d);
@@ -198,6 +199,7 @@ public class SliderCaptchaTemplate {
return false;
}
private String transformBase64(BufferedImage bufferedImage, String formatName) {
byte[] data = null;
try (ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream()) {