Base: fix quantity construction when unit as string is empty

This commit is contained in:
0penBrain
2022-04-02 18:09:35 +02:00
committed by wwmayer
parent 7dc130b00f
commit 65822ec2f8
+6
View File
@@ -88,6 +88,12 @@ Quantity::Quantity(double value, const Unit& unit)
Quantity::Quantity(double value, const QString& unit)
{
if (unit.isEmpty()) {
this->_Value = value;
this->_Unit = Unit();
return;
}
try {
auto tmpQty = parse(unit);
this->_Unit = tmpQty.getUnit();