From 52b9842ced222ac05f54058833f9404409eb0c79 Mon Sep 17 00:00:00 2001 From: seth_productengine Date: Thu, 7 Jul 2011 21:09:09 +0300 Subject: STORM-1476 FIXED Replaced non-fatal errors in LLDirIterator constructor with warnings to avoid viewer crashes. Added exception handling case. --- indra/llvfs/lldiriterator.cpp | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'indra/llvfs/lldiriterator.cpp') diff --git a/indra/llvfs/lldiriterator.cpp b/indra/llvfs/lldiriterator.cpp index 25550321f0..ff92cbb7fd 100644 --- a/indra/llvfs/lldiriterator.cpp +++ b/indra/llvfs/lldiriterator.cpp @@ -52,8 +52,20 @@ LLDirIterator::Impl::Impl(const std::string &dirname, const std::string &mask) { fs::path dir_path(dirname); - // Check if path exists. - if (!fs::exists(dir_path)) + bool is_dir = false; + + // Check if path is a directory. + try + { + is_dir = fs::is_directory(dir_path); + } + catch (fs::basic_filesystem_error& e) + { + llwarns << e.what() << llendl; + return; + } + + if (!is_dir) { llwarns << "Invalid path: \"" << dir_path.string() << "\"" << llendl; return; @@ -66,7 +78,7 @@ LLDirIterator::Impl::Impl(const std::string &dirname, const std::string &mask) } catch (fs::basic_filesystem_error& e) { - llerrs << e.what() << llendl; + llwarns << e.what() << llendl; return; } @@ -82,7 +94,7 @@ LLDirIterator::Impl::Impl(const std::string &dirname, const std::string &mask) } catch (boost::regex_error& e) { - llerrs << "\"" << exp << "\" is not a valid regular expression: " + llwarns << "\"" << exp << "\" is not a valid regular expression: " << e.what() << llendl; return; } -- cgit v1.2.3