Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/ImageSharp/Primitives/Rational.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@ public Rational(double value, bool bestPrecision)

this.Numerator = (uint)rational.Numerator;
this.Denominator = (uint)rational.Denominator;

if(this.Numerator == 0 && this.Denominator == 0)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there's an issue here it will have to be fixed in LongRational

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you want to update GPS location of ExifInformation, it accepts Retional[]. That's why I suggest this change. Anyway if you are creating Rational.FromDouble(0) Denominator shouldn't be 0.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, you're right, the problem is deeper on line 206 of LongRational.cs it should be

return new LongRational(0, 1);

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's the correct fix. Can you also add some unit tests for this to make sure this stays fixed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, sure will do that and will push all as a different pull request. You can close this one.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to open a new PR. That’s just confusing. Push to this one please.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And you can also use a force push to update this PR with a new set of commits.

{
this.Denominator = 1;
}
}

/// <summary>
Expand Down