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) ...@@ -57,14 +57,21 @@ std::vector<std::string> GetFilesInDirectory(const std::string & directoryPath)
// End iterator : default construction yields past-the-end // End iterator : default construction yields past-the-end
for ( const auto & item : boost::make_iterator_range(boost::filesystem::directory_iterator(directoryPath), {}) ) 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()); if ( boost::filesystem::is_directory(item.status()) )
fileList.insert(fileList.end(), subDirList.begin(), subDirList.end()); {
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