Website Summary Files Commits Branches @commit @diff @stats
path: root / src / Models / CellFormula.cpp
diff options
context:
space:
mode:
Commit0b7357b568824d5d46b6d5ea931842e3e4bdcc00 (patch)
Author
 Syndamia <kamen@syndamia.com>
2022-06-14 12:54:06 +0300
Committer
 Syndamia <kamen@syndamia.com>
2022-06-14 12:54:06 +0300
Files917e1ae163ba3fe3598265a6b0fb3da9ae00e86a /src/Models/CellFormula.cpp
FMI-OOP-P2_Tables-0b7357b568824d5d46b6d5ea931842e3e4bdcc00.tar
FMI-OOP-P2_Tables-0b7357b568824d5d46b6d5ea931842e3e4bdcc00.tar.gz
FMI-OOP-P2_Tables-0b7357b568824d5d46b6d5ea931842e3e4bdcc00.zip
Parent3b200a7a4737086de7723bfe9dbb000bd2eba9ec (diff)
Autocommit at 14.06.2022 @ 12:54
1 files changed, 7 insertions, 0 deletions
-rw-r--r--src/Models/CellFormula.cpp7
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);