Spreadsheet: Fixed crash when invalid unit was given as input.
This commit is contained in:
parent
e230f3c5e7
commit
6c80dd4eae
|
@ -364,8 +364,10 @@ void Cell::setDisplayUnit(const std::string &unit)
|
|||
{
|
||||
DisplayUnit newDisplayUnit;
|
||||
if (unit.size() > 0) {
|
||||
std::auto_ptr<App::UnitExpression> e(ExpressionParser::parseUnit(owner->sheet(), unit.c_str()));
|
||||
boost::shared_ptr<App::UnitExpression> e(ExpressionParser::parseUnit(owner->sheet(), unit.c_str()));
|
||||
|
||||
if (!e)
|
||||
throw Base::Exception("Invalid unit");
|
||||
newDisplayUnit = DisplayUnit(unit, e->getUnit(), e->getScaler());
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user