Base: fix quantity construction when unit as string is empty

This commit is contained in:
0penBrain
2022-03-30 18:09:18 +02:00
committed by wwmayer
parent 29c3417285
commit caa4784550

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();