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
|
//Reduce the fraction to lowest terms
|
||||||
Fraction modifiedFraction = this;
|
Fraction modifiedFraction = this;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
//While the numerator and denominator share a greatest common denominator,
|
//While the numerator and denominator share a greatest common denominator,
|
||||||
//keep dividing both by it
|
//keep dividing both by it
|
||||||
int gcd = 0;
|
int gcd = 0;
|
||||||
@@ -126,6 +128,11 @@ namespace Flowframes.Data
|
|||||||
modifiedFraction.Numerator = -this.Numerator;
|
modifiedFraction.Numerator = -this.Numerator;
|
||||||
modifiedFraction.Denominator = -this.Denominator;
|
modifiedFraction.Denominator = -this.Denominator;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Logger.Log($"Failed to reduce fraction ({modifiedFraction}): {e.Message}", true);
|
||||||
|
}
|
||||||
|
|
||||||
return modifiedFraction;
|
return modifiedFraction;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user