diff --git a/src/Mod/Spreadsheet/Gui/SpreadsheetView.cpp b/src/Mod/Spreadsheet/Gui/SpreadsheetView.cpp index 6032380cad..cac8a3a8f6 100644 --- a/src/Mod/Spreadsheet/Gui/SpreadsheetView.cpp +++ b/src/Mod/Spreadsheet/Gui/SpreadsheetView.cpp @@ -234,10 +234,8 @@ void SheetView::updateContentLine() if (i.isValid()) { std::string str; - Cell * cell = sheet->getCell(CellAddress(i.row(), i.column())); - - if (cell) - cell->getStringContent(str); + if (const auto * cell = sheet->getCell(CellAddress(i.row(), i.column()))) + (void)cell->getStringContent(str); ui->cellContent->setText(QString::fromUtf8(str.c_str())); ui->cellContent->setIndex(i); ui->cellContent->setEnabled(true); @@ -253,10 +251,8 @@ void SheetView::updateAliasLine() if (i.isValid()) { std::string str; - Cell * cell = sheet->getCell(CellAddress(i.row(), i.column())); - - if (cell) - cell->getAlias(str); + if (const auto * cell = sheet->getCell(CellAddress(i.row(), i.column()))) + (void)cell->getAlias(str); ui->cellAlias->setText(QString::fromUtf8(str.c_str())); ui->cellAlias->setIndex(i); ui->cellAlias->setEnabled(true); @@ -350,12 +346,11 @@ void SheetView::editingFinished() ui->cellAlias->setDocumentObject(sheet); ui->cells->model()->setData(i, QVariant(ui->cellContent->text()), Qt::EditRole); - Cell * cell = sheet->getCell(CellAddress(i.row(), i.column())); - if (cell){ + if (const auto * cell = sheet->getCell(CellAddress(i.row(), i.column()))){ if (!aliasOkay){ //do not show error message if failure to set new alias is because it is already the same string std::string current_alias; - cell->getAlias(current_alias); + (void)cell->getAlias(current_alias); if (str != QString::fromUtf8(current_alias.c_str())){ Base::Console().Error("Unable to set alias: %s\n", Base::Tools::toStdString(str).c_str()); }