diff --git a/src/Mod/Spreadsheet/App/Cell.cpp b/src/Mod/Spreadsheet/App/Cell.cpp index 0867951ce..750b5c06b 100644 --- a/src/Mod/Spreadsheet/App/Cell.cpp +++ b/src/Mod/Spreadsheet/App/Cell.cpp @@ -364,8 +364,10 @@ void Cell::setDisplayUnit(const std::string &unit) { DisplayUnit newDisplayUnit; if (unit.size() > 0) { - std::auto_ptr e(ExpressionParser::parseUnit(owner->sheet(), unit.c_str())); + boost::shared_ptr e(ExpressionParser::parseUnit(owner->sheet(), unit.c_str())); + if (!e) + throw Base::Exception("Invalid unit"); newDisplayUnit = DisplayUnit(unit, e->getUnit(), e->getScaler()); }