Skip to content

Commit

Permalink
checking for NaN, not just zero (#12058)
Browse files Browse the repository at this point in the history
  • Loading branch information
crutkas committed Jul 1, 2021
1 parent 67d6abc commit 79883e5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/modules/imageresizer/ui/Models/ResizeSize.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public bool ShowHeight
}

public bool HasAuto
=> Width == 0 || Height == 0;
=> Width == 0 || Height == 0 || double.IsNaN(Width) || double.IsNaN(Height);

[JsonProperty(PropertyName = "unit")]
public ResizeUnit Unit
Expand Down Expand Up @@ -125,7 +125,7 @@ private void UpdateShowHeight()

private double ConvertToPixels(double value, ResizeUnit unit, int originalValue, double dpi)
{
if (value == 0)
if (value == 0 || double.IsNaN(value))
{
if (Fit == ResizeFit.Fit)
{
Expand Down

0 comments on commit 79883e5

Please sign in to comment.