From 8769c933ad0553239cc031f0fe6581ff7d6075b5 Mon Sep 17 00:00:00 2001 From: Wouter Jansen Date: Mon, 30 Sep 2024 14:34:11 +0200 Subject: [PATCH] If material CSV file is empty or contains only empty line it will skip the creation. Fixed #33 (cherry picked from commit 52e398922a480f2a40deb05003f3672f59e7c0d3) --- Unreal/Plugins/AirSim/Source/LidarCamera.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Unreal/Plugins/AirSim/Source/LidarCamera.cpp b/Unreal/Plugins/AirSim/Source/LidarCamera.cpp index 0dbe831ed..dccd3eadc 100755 --- a/Unreal/Plugins/AirSim/Source/LidarCamera.cpp +++ b/Unreal/Plugins/AirSim/Source/LidarCamera.cpp @@ -189,8 +189,10 @@ void ALidarCamera::InitializeSettingsFromAirSim(const msr::airlib::GPULidarSimpl while (std::getline(ss, word, ',')) { row.push_back(word); } - material_map_.emplace(stencil_index, std::stof(row[1])); - stencil_index = stencil_index + 1; + if (row.size() > 1) { + material_map_.emplace(stencil_index, std::stof(row[1])); + stencil_index = stencil_index + 1; + } } // Set the sensor in the Unreal world at the right position and rotation by transforming the coordinate system to that of Unreal from AirSim NED