mirror of
https://github.com/n00mkrad/flowframes.git
synced 2025-12-21 10:49:25 +01:00
Possibly fixed Fraction division-by-zero exception? (can't reproduce)
This commit is contained in:
@@ -111,6 +111,8 @@ namespace Flowframes.Data
|
||||
//Reduce the fraction to lowest terms
|
||||
Fraction modifiedFraction = this;
|
||||
|
||||
try
|
||||
{
|
||||
//While the numerator and denominator share a greatest common denominator,
|
||||
//keep dividing both by it
|
||||
int gcd = 0;
|
||||
@@ -126,6 +128,11 @@ namespace Flowframes.Data
|
||||
modifiedFraction.Numerator = -this.Numerator;
|
||||
modifiedFraction.Denominator = -this.Denominator;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.Log($"Failed to reduce fraction ({modifiedFraction}): {e.Message}", true);
|
||||
}
|
||||
|
||||
return modifiedFraction;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user