1
Fork 0
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:
AnotherTest 2020-12-22 07:04:59 +03:30 committed by Andreas Kling
parent 7c8d35600c
commit bfb25855cb

View file

@ -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];