1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 06:37:35 +00:00

Spreadsheet: Correctly resolve nonstandard column names

This commit is contained in:
Ali Mohammad Pur 2021-06-16 08:35:40 +04:30 committed by Ali Mohammad Pur
parent b11b3c2f1c
commit a01358f015

View file

@ -209,8 +209,12 @@ Optional<Position> Sheet::parse_cell_name(const StringView& name) const
Optional<size_t> Sheet::column_index(const StringView& column_name) const
{
auto index = convert_from_string(column_name);
if (m_columns.size() <= index || m_columns[index] != column_name)
return {};
if (m_columns.size() <= index || m_columns[index] != column_name) {
auto it = m_columns.find(column_name);
if (it == m_columns.end())
return {};
index = it.index();
}
return index;
}