better error handling

This commit is contained in:
rusefi 2024-05-02 12:11:49 -04:00
parent f635029c6a
commit c422337b55
1 changed files with 3 additions and 0 deletions

View File

@ -30,6 +30,9 @@ void CsvReader::open(const char *fileName, const int* triggerColumnIndeces, cons
}
bool CsvReader::haveMore() {
if (fp == nullptr) {
throw std::runtime_error("No file");
}
bool result = fgets(buffer, sizeof(buffer), fp) != nullptr;
m_lineIndex++;
if (m_lineIndex == 0) {