Fix crash when a format is applied and one or more columns are selected

The at() method raises exception when the key is not in the map, so for
std::map we have to check beforehand and return an empty filter.
This commit is contained in:
mgrojo
2020-08-05 13:58:44 +02:00
parent b6e3db34d0
commit 4f9e7c5d04
+3 -1
View File
@@ -629,7 +629,9 @@ void TableBrowser::modifyFormat(std::function<void(CondFormat&)> changeFunction)
const std::unordered_set<size_t>& columns = ui->dataTable->selectedCols();
if (columns.size() > 0) {
for (size_t column : columns) {
const QString& filter = m_settings[currentlyBrowsedTableName()].filterValues.at(column);
QString filter;
if (m_settings[currentlyBrowsedTableName()].filterValues.count(column) > 0)
filter = m_settings[currentlyBrowsedTableName()].filterValues.at(column);
modifySingleFormat(false, filter, currentIndex().sibling(currentIndex().row(), static_cast<int>(column)), changeFunction);
}
} else {