From 65822ec2f84ca6de431763eb6fc03d85fa2a0455 Mon Sep 17 00:00:00 2001 From: 0penBrain <48731257+0penBrain@users.noreply.github.com> Date: Wed, 30 Mar 2022 18:09:18 +0200 Subject: [PATCH] Base: fix quantity construction when unit as string is empty --- src/Base/Quantity.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Base/Quantity.cpp b/src/Base/Quantity.cpp index 16ac75f295..e16e036c62 100644 --- a/src/Base/Quantity.cpp +++ b/src/Base/Quantity.cpp @@ -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();