From 68f6b62e49916a59442f4ae69fc0554bf1d84f3a Mon Sep 17 00:00:00 2001 From: Syndamia Date: Sat, 28 May 2022 18:29:27 +0300 Subject: Autocommit at 28.05.2022 @ 18:29 --- src/Models/Table.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src/Models/Table.cpp') diff --git a/src/Models/Table.cpp b/src/Models/Table.cpp index bcaffb7..5d0c87f 100644 --- a/src/Models/Table.cpp +++ b/src/Models/Table.cpp @@ -19,12 +19,14 @@ bool containsNumber(const char*& str) { } void Table::putCell(unsigned row, unsigned col, const char* rawValue) { - unsigned intParse = atoi(rawValue); - unsigned doubleParse = atof(rawValue); Cell* newCell; - if (doubleParse - intParse > 0.00001 && doublePrase > 0.00001) - newCell = new CellDouble(doubleParse); - else if (intParse ) - newCell = + if (containsNumber(rawValue)) { + unsigned intParse = atoi(rawValue); + unsigned doubleParse = atof(rawValue); + + newCell = (doubleParse - intParse > 0.00001 && doubleParse > 0.00001) + ? new CellDouble(doubleParse) : new CellInt(intParse); + } + } -- cgit v1.3.1-23-gd82d