From 70e3c79fd88c2f9a4e6da6674fa90ed9c106b51d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=2E=20Fatih=20C=C4=B1r=C4=B1t?= Date: Thu, 2 Nov 2023 08:08:56 +0300 Subject: [PATCH] fix(raw_vehicle_cmd_converter): return false if table is empty (#5463) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: M. Fatih Cırıt --- vehicle/raw_vehicle_cmd_converter/src/csv_loader.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/vehicle/raw_vehicle_cmd_converter/src/csv_loader.cpp b/vehicle/raw_vehicle_cmd_converter/src/csv_loader.cpp index 7e42551454e24..a6a331a0e7324 100644 --- a/vehicle/raw_vehicle_cmd_converter/src/csv_loader.cpp +++ b/vehicle/raw_vehicle_cmd_converter/src/csv_loader.cpp @@ -85,6 +85,10 @@ bool CSVLoader::validateMap(const Map & map, const bool is_col_decent) bool CSVLoader::validateData(const Table & table, const std::string & csv_path) { + if (table.empty()) { + std::cerr << "The table is empty." << std::endl; + return false; + } if (table[0].size() < 2) { std::cerr << "Cannot read " << csv_path.c_str() << " CSV file should have at least 2 column" << std::endl;