From 4de0a72786f6b04e4814b9236d3ce73109e4feb1 Mon Sep 17 00:00:00 2001 From: itsmattkc Date: Mon, 24 May 2021 16:04:46 +1000 Subject: [PATCH] rational: don't flip if null Fixes issue where flipped rationals would erroneously create a NaN. Fixes #1641 Fixes #1642 --- app/common/rational.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/common/rational.cpp b/app/common/rational.cpp index 8d12a69a1..fd5641047 100644 --- a/app/common/rational.cpp +++ b/app/common/rational.cpp @@ -142,7 +142,9 @@ rational rational::flipped() const void rational::flip() { - std::swap(denom_, numer_); + if (!isNull()) { + std::swap(denom_, numer_); + } } bool rational::isNull() const