Skip to content

Commit

Permalink
return errors early to avoid long loop read excel file
Browse files Browse the repository at this point in the history
  • Loading branch information
shun2wang authored and JorisGoosen committed Nov 11, 2024
1 parent 462cb41 commit c8d2524
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Desktop/data/importers/excelimporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include "excelimporter.h"
#include "data/importers/excel/excel.h"
#include "data/importers/excel/excelimportcolumn.h"
#include "utilities/qutils.h"
#include <columnutils.h>
#include <string>
#include <QFileInfo>
Expand Down Expand Up @@ -56,6 +57,9 @@ ImportDataSet* ExcelImporter::loadFile(const std::string &locator, std::function
cols = excel.countCols();
importColumns.reserve(cols);

if (cols == 0)
throw std::runtime_error(fq(tr("0 valid columns were read from the file, please check your data file.")));

for (uint32_t row = 0; row < rows; ++row)
{
stringvec lineValues;
Expand Down

0 comments on commit c8d2524

Please sign in to comment.