mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 23:17:46 +00:00
Spreadsheet: Do not attempt to create columns with "negative" indices
This commit is contained in:
parent
7c8d35600c
commit
bfb25855cb
1 changed files with 3 additions and 0 deletions
|
@ -248,6 +248,9 @@ Optional<String> Sheet::column_arithmetic(const StringView& column_name, int off
|
|||
if (!maybe_index.has_value())
|
||||
return {};
|
||||
|
||||
if (offset < 0 && maybe_index.value() < (size_t)(0 - offset))
|
||||
return m_columns.first();
|
||||
|
||||
auto index = maybe_index.value() + offset;
|
||||
if (m_columns.size() > index)
|
||||
return m_columns[index];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue