checking for NaN, not just zero (#12058)

This commit is contained in:
Clint Rutkas 2021-06-30 17:16:45 -07:00 committed by GitHub
parent 9c248cdcd2
commit 03eb9c3f5c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -84,7 +84,7 @@ namespace ImageResizer.Models
}
public bool HasAuto
=> Width == 0 || Height == 0;
=> Width == 0 || Height == 0 || double.IsNaN(Width) || double.IsNaN(Height);
[JsonProperty(PropertyName = "unit")]
public ResizeUnit Unit
@ -125,7 +125,7 @@ namespace ImageResizer.Models
private double ConvertToPixels(double value, ResizeUnit unit, int originalValue, double dpi)
{
if (value == 0)
if (value == 0 || double.IsNaN(value))
{
if (Fit == ResizeFit.Fit)
{