diff --git a/LibCarla/source/carla/FileSystem.cpp b/LibCarla/source/carla/FileSystem.cpp index f33158f08..511632bb9 100644 --- a/LibCarla/source/carla/FileSystem.cpp +++ b/LibCarla/source/carla/FileSystem.cpp @@ -17,7 +17,7 @@ namespace carla { void FileSystem::ValidateFilePath(std::string &filepath, const std::string &ext) { fs::path path(filepath); - if (path.extension() != ext) + if (!ext.empty() && path.extension() != ext) path.replace_extension(ext); auto parent = path.parent_path(); if (!fs::exists(parent)) diff --git a/Unreal/CarlaUnreal/Plugins/Carla/Source/Carla/Server/CarlaServer.cpp b/Unreal/CarlaUnreal/Plugins/Carla/Source/Carla/Server/CarlaServer.cpp index 17f3c4936..97eaa95f9 100644 --- a/Unreal/CarlaUnreal/Plugins/Carla/Source/Carla/Server/CarlaServer.cpp +++ b/Unreal/CarlaUnreal/Plugins/Carla/Source/Carla/Server/CarlaServer.cpp @@ -538,7 +538,7 @@ void FCarlaServer::FPimpl::BindActions() REQUIRE_CARLA_EPISODE(); // Check that the path ends in a slash, add it otherwise - if (folder[folder.size() - 1] != '/' && folder[folder.size() - 1] != '\\') { + if (!folder.empty() && folder[folder.size() - 1] != '/' && folder[folder.size() - 1] != '\\') { folder += "/"; }