summaryrefslogtreecommitdiff
path: root/Userland/Applications
diff options
context:
space:
mode:
Diffstat (limited to 'Userland/Applications')
-rw-r--r--Userland/Applications/Spreadsheet/Spreadsheet.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/Userland/Applications/Spreadsheet/Spreadsheet.cpp b/Userland/Applications/Spreadsheet/Spreadsheet.cpp
index 42186bcebc..df1dc07a12 100644
--- a/Userland/Applications/Spreadsheet/Spreadsheet.cpp
+++ b/Userland/Applications/Spreadsheet/Spreadsheet.cpp
@@ -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;
}