Skip to content
Snippets Groups Projects
Commit 52b9842c authored by seth_productengine's avatar seth_productengine
Browse files

STORM-1476 FIXED Replaced non-fatal errors in LLDirIterator constructor with...

STORM-1476 FIXED Replaced non-fatal errors in LLDirIterator constructor with warnings to avoid viewer crashes.
Added exception handling case.
parent 66dcc728
No related branches found
No related tags found
No related merge requests found
...@@ -52,8 +52,20 @@ LLDirIterator::Impl::Impl(const std::string &dirname, const std::string &mask) ...@@ -52,8 +52,20 @@ LLDirIterator::Impl::Impl(const std::string &dirname, const std::string &mask)
{ {
fs::path dir_path(dirname); fs::path dir_path(dirname);
// Check if path exists. bool is_dir = false;
if (!fs::exists(dir_path))
// Check if path is a directory.
try
{
is_dir = fs::is_directory(dir_path);
}
catch (fs::basic_filesystem_error<fs::path>& e)
{
llwarns << e.what() << llendl;
return;
}
if (!is_dir)
{ {
llwarns << "Invalid path: \"" << dir_path.string() << "\"" << llendl; llwarns << "Invalid path: \"" << dir_path.string() << "\"" << llendl;
return; return;
...@@ -66,7 +78,7 @@ LLDirIterator::Impl::Impl(const std::string &dirname, const std::string &mask) ...@@ -66,7 +78,7 @@ LLDirIterator::Impl::Impl(const std::string &dirname, const std::string &mask)
} }
catch (fs::basic_filesystem_error<fs::path>& e) catch (fs::basic_filesystem_error<fs::path>& e)
{ {
llerrs << e.what() << llendl; llwarns << e.what() << llendl;
return; return;
} }
...@@ -82,7 +94,7 @@ LLDirIterator::Impl::Impl(const std::string &dirname, const std::string &mask) ...@@ -82,7 +94,7 @@ LLDirIterator::Impl::Impl(const std::string &dirname, const std::string &mask)
} }
catch (boost::regex_error& e) catch (boost::regex_error& e)
{ {
llerrs << "\"" << exp << "\" is not a valid regular expression: " llwarns << "\"" << exp << "\" is not a valid regular expression: "
<< e.what() << llendl; << e.what() << llendl;
return; return;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment