From 0b7357b568824d5d46b6d5ea931842e3e4bdcc00 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Tue, 14 Jun 2022 12:54:06 +0300 Subject: Autocommit at 14.06.2022 @ 12:54 --- src/Models/CellFormula.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/Models/CellFormula.cpp') diff --git a/src/Models/CellFormula.cpp b/src/Models/CellFormula.cpp index f26ce0e..745c623 100644 --- a/src/Models/CellFormula.cpp +++ b/src/Models/CellFormula.cpp @@ -96,6 +96,8 @@ void CellFormula::parseAndSetValue(const char* str) { rawFormula = String(str); formula.clear(); + localCells.clear(); + localCells.add(CellDouble(0.0)); Pair loc; char currOp = 0; @@ -111,6 +113,11 @@ void CellFormula::parseAndSetValue(const char* str) { buffer.clear(); D(str, buffer); loc.right = atoi(buffer.raw_data()) - 1; + if (loc.left < 0 || loc.right < 0 + || tableCells->get_count() - 1 < loc.left || tableCells[loc.left].get_count() - 1 < loc.right) { + loc.left = -1; + loc.right = 0; + } } else if (*str >= '0' && *str <= '9') { D(str, buffer); -- cgit v1.3.1-23-gd82d