diff options
author | Caolán McNamara <caolanm@redhat.com> | 2022-06-27 15:57:02 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2022-06-27 18:46:04 +0200 |
commit | e7b3c961e95fdf51557702f2e74db796a6bd2c09 (patch) | |
tree | 92585b71f8ee2c642a9f7e95c245785de9dac43b /sc | |
parent | a15fe37bf1dc50fcf88cea9c0038b217119671b8 (diff) |
cid#1506511 silence Uncaught exception
and
cid#1506512 Uncaught exception
cid#1506513 Uncaught exception
Change-Id: I964430a69ce4d4beb7f7a551d3ac454c8122a3fa
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136503
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/inc/cellvalue.hxx | 2 | ||||
-rw-r--r-- | sc/source/core/data/cellvalue.cxx | 19 |
2 files changed, 14 insertions, 7 deletions
diff --git a/sc/inc/cellvalue.hxx b/sc/inc/cellvalue.hxx index 75e144c77252..6db9dee493cf 100644 --- a/sc/inc/cellvalue.hxx +++ b/sc/inc/cellvalue.hxx @@ -33,6 +33,8 @@ struct SC_DLLPUBLIC ScCellValue private: /// std::monostate is there to indicate CellType::NONE std::variant<std::monostate, double, svl::SharedString, EditTextObject*, ScFormulaCell*> maData; + + void reset_to_empty(); public: ScCellValue(); diff --git a/sc/source/core/data/cellvalue.cxx b/sc/source/core/data/cellvalue.cxx index 44fde8c7ed03..4330ea972992 100644 --- a/sc/source/core/data/cellvalue.cxx +++ b/sc/source/core/data/cellvalue.cxx @@ -277,10 +277,15 @@ ScCellValue::ScCellValue( const ScCellValue& r ) } } +void ScCellValue::reset_to_empty() +{ + suppress_fun_call_w_exception(maData = std::monostate()); // reset to empty; +} + ScCellValue::ScCellValue(ScCellValue&& r) noexcept : maData(std::move(r.maData)) { - r.maData = std::monostate(); // reset to empty; + r.reset_to_empty(); } ScCellValue::~ScCellValue() @@ -308,17 +313,17 @@ void ScCellValue::clear() noexcept switch (getType()) { case CELLTYPE_EDIT: - delete getEditText(); + suppress_fun_call_w_exception(delete getEditText()); break; case CELLTYPE_FORMULA: - delete getFormula(); + suppress_fun_call_w_exception(delete getFormula()); break; default: ; } // Reset to empty value. - maData = std::monostate(); + reset_to_empty(); } void ScCellValue::set( double fValue ) @@ -475,7 +480,7 @@ void ScCellValue::release( ScDocument& rDoc, const ScAddress& rPos ) rDoc.SetEmptyCell(rPos); } - maData = std::monostate(); // reset to empty + reset_to_empty(); // reset to empty } void ScCellValue::release( ScColumn& rColumn, SCROW nRow, sc::StartListeningType eListenType ) @@ -503,7 +508,7 @@ void ScCellValue::release( ScColumn& rColumn, SCROW nRow, sc::StartListeningType rColumn.DeleteContent(nRow); } - maData = std::monostate(); // reset to empty + reset_to_empty(); // reset to empty } OUString ScCellValue::getString( const ScDocument& rDoc ) const @@ -532,7 +537,7 @@ ScCellValue& ScCellValue::operator=(ScCellValue&& rCell) noexcept { clear(); maData = std::move(rCell.maData); - rCell.maData = std::monostate(); // reset to empty; + rCell.reset_to_empty(); // reset to empty; return *this; } |