From 499a22cf9e6e6ce0cb396a53a25d22a1e63c734f Mon Sep 17 00:00:00 2001 From: Syndamia Date: Mon, 30 May 2022 20:08:16 +0300 Subject: Autocommit at 30.05.2022 @ 20:08 --- src/Models/Table.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/Models/Table.cpp') diff --git a/src/Models/Table.cpp b/src/Models/Table.cpp index 04fb7b7..892a05d 100644 --- a/src/Models/Table.cpp +++ b/src/Models/Table.cpp @@ -153,9 +153,11 @@ void Table::saveToFile(const char* filePath) const { std::ofstream outFile(filePath); if (!outFile.is_open()) throw std::logic_error("Could not open file!"); + for (unsigned i = 0; i < cells.get_count(); i++) { for (unsigned j = 0; j < cells.get_count(); j++) { - cells[i][j]->writeToFile(outFile); + if (cells[i][j] != nullptr) + cells[i][j]->writeToFile(outFile); outFile << ','; } outFile << '\n'; -- cgit v1.3.1-23-gd82d