From 7349eb519809e106d9e68b5c2ad473d0a0ee93d8 Mon Sep 17 00:00:00 2001 From: 0penBrain <48731257+0penBrain@users.noreply.github.com> Date: Fri, 19 Nov 2021 16:24:55 +0100 Subject: [PATCH] [Sheet] Prevent duplicate call to 'nonNullCellAt' --- src/Mod/Spreadsheet/App/PropertySheet.cpp | 36 +++++++++++++---------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/src/Mod/Spreadsheet/App/PropertySheet.cpp b/src/Mod/Spreadsheet/App/PropertySheet.cpp index 571453c1a1..8ad988995b 100644 --- a/src/Mod/Spreadsheet/App/PropertySheet.cpp +++ b/src/Mod/Spreadsheet/App/PropertySheet.cpp @@ -477,39 +477,43 @@ Cell * PropertySheet::nonNullCellAt(CellAddress address) void PropertySheet::setContent(CellAddress address, const char *value) { Cell * cell = nonNullCellAt(address); - assert(cell != 0); - cell->setContent(value); } void PropertySheet::setAlignment(CellAddress address, int _alignment) { - nonNullCellAt(address)->setAlignment(_alignment); + Cell * cell = nonNullCellAt(address); + assert(cell != 0); + cell->setAlignment(_alignment); } void PropertySheet::setStyle(CellAddress address, const std::set &_style) { - assert(nonNullCellAt(address) != 0); - nonNullCellAt(address)->setStyle(_style); + Cell * cell = nonNullCellAt(address); + assert(cell != 0); + cell->setStyle(_style); } void PropertySheet::setForeground(CellAddress address, const App::Color &color) { - assert(nonNullCellAt(address) != 0); - nonNullCellAt(address)->setForeground(color); + Cell * cell = nonNullCellAt(address); + assert(cell != 0); + cell->setForeground(color); } void PropertySheet::setBackground(CellAddress address, const App::Color &color) { - assert(nonNullCellAt(address) != 0); - nonNullCellAt(address)->setBackground(color); + Cell * cell = nonNullCellAt(address); + assert(cell != 0); + cell->setBackground(color); } void PropertySheet::setDisplayUnit(CellAddress address, const std::string &unit) { - assert(nonNullCellAt(address) != 0); - nonNullCellAt(address)->setDisplayUnit(unit); + Cell * cell = nonNullCellAt(address); + assert(cell != 0); + cell->setDisplayUnit(unit); } @@ -561,14 +565,16 @@ void PropertySheet::setAlias(CellAddress address, const std::string &alias) void PropertySheet::setComputedUnit(CellAddress address, const Base::Unit &unit) { - assert(nonNullCellAt(address) != 0); - nonNullCellAt(address)->setComputedUnit(unit); + Cell * cell = nonNullCellAt(address); + assert(cell != 0); + cell->setComputedUnit(unit); } void PropertySheet::setSpans(CellAddress address, int rows, int columns) { - assert(nonNullCellAt(address) != 0); - nonNullCellAt(address)->setSpans(rows, columns); + Cell * cell = nonNullCellAt(address); + assert(cell != 0); + cell->setSpans(rows, columns); } void PropertySheet::clearAlias(CellAddress address)