diff options
Autocommit at 14.06.2022 @ 12:54
1 files changed, 7 insertions, 0 deletions
| -rw-r--r-- | src/Models/CellFormula.cpp | 7 |
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<int, int> 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); |
