Commit b7f91e5b authored by Julien Osman's avatar Julien Osman
Browse files

BUG: Prevent segfault when invalid simlink in DEM directory

parent 6a79318a
......@@ -57,14 +57,21 @@ std::vector<std::string> GetFilesInDirectory(const std::string & directoryPath)
// End iterator : default construction yields past-the-end
for ( const auto & item : boost::make_iterator_range(boost::filesystem::directory_iterator(directoryPath), {}) )
{
if ( boost::filesystem::is_directory(item.status()) )
try
{
auto subDirList = GetFilesInDirectory(item.path().string());
fileList.insert(fileList.end(), subDirList.begin(), subDirList.end());
if ( boost::filesystem::is_directory(item.status()) )
{
auto subDirList = GetFilesInDirectory(item.path().string());
fileList.insert(fileList.end(), subDirList.begin(), subDirList.end());
}
else
{
fileList.push_back(item.path().string());
}
}
else
catch (boost::filesystem::filesystem_error& e)
{
fileList.push_back(item.path().string());
otbLogMacro(Warning, << e.what())
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment