diff --git a/GeoLib/SensorData.cpp b/GeoLib/SensorData.cpp index 97e76245440618cef86082d23b9570b620323827..71093b40b8b005e21bd37f047d3901d0ae7b9249 100644 --- a/GeoLib/SensorData.cpp +++ b/GeoLib/SensorData.cpp @@ -154,24 +154,22 @@ int SensorData::readDataFromFile(const std::string& file_name) { fields = BaseLib::splitString(line, '\t'); - if (nFields == fields.size()) + if (nFields != fields.size()) { - it = fields.begin(); - std::size_t pos(it->rfind(".")); - std::size_t current_time_step = (pos == std::string::npos) - ? atoi((it++)->c_str()) - : BaseLib::strDate2int(*it++); - this->_time_steps.push_back(current_time_step); - - for (std::size_t i = 0; i < nDataArrays; i++) - { - this->_data_vecs[i]->push_back( - static_cast<float>(strtod((it++)->c_str(), nullptr))); - } + return 0; } - else + + it = fields.begin(); + std::size_t const pos(it->rfind(".")); + std::size_t const current_time_step = (pos == std::string::npos) + ? atoi((it++)->c_str()) + : BaseLib::strDate2int(*it++); + this->_time_steps.push_back(current_time_step); + + for (std::size_t i = 0; i < nDataArrays; i++) { - return 0; + this->_data_vecs[i]->push_back( + static_cast<float>(strtod((it++)->c_str(), nullptr))); } }