Fixed buggy implementation of CPhysicalQuantity::lessThan.

This bug could cause a variant containing a list containing a null PQ
to compare equal to a variant containing a list containing a non-null PQ.
This commit is contained in:
Mat Sutcliffe
2019-03-29 00:17:18 +00:00
parent 38fe2d1c49
commit e5e6c53c82
3 changed files with 14 additions and 4 deletions

View File

@@ -222,7 +222,10 @@ namespace BlackMisc
bool CPhysicalQuantity<MU, PQ>::lessThan(const CPhysicalQuantity<MU, PQ> &other) const
{
if (*this == other) return false;
if (this->isNull() || other.isNull()) return false;
if (isNull() < other.isNull()) { return true; }
if (isNull() > other.isNull()) { return false; }
if (isNull() && other.isNull()) { return false; }
return (m_value < other.value(m_unit));
}