diff options
author | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2025-05-19 21:51:55 +0300 |
---|---|---|
committer | Andrey Kleshchev <117672381+akleshchev@users.noreply.github.com> | 2025-05-20 16:15:29 +0300 |
commit | 1d40793b175637cee2f7fb36106349aa43d71c0d (patch) | |
tree | cd0bf472181add51457d50bf6b327a5658920294 | |
parent | 479a23af5ed53256d52c93885315478be7a6ad53 (diff) |
#4101 Handle boost::filesystem's exceptions
-rw-r--r-- | indra/llfilesystem/lldir.cpp | 5 | ||||
-rw-r--r-- | indra/newview/llviewerwindow.cpp | 16 |
2 files changed, 17 insertions, 4 deletions
diff --git a/indra/llfilesystem/lldir.cpp b/indra/llfilesystem/lldir.cpp index 99d4850610..b80243c22e 100644 --- a/indra/llfilesystem/lldir.cpp +++ b/indra/llfilesystem/lldir.cpp @@ -110,9 +110,10 @@ std::vector<std::string> LLDir::getFilesInDir(const std::string &dirname) std::vector<std::string> v; - if (exists(p)) + boost::system::error_code ec; + if (exists(p, ec) && !ec.failed()) { - if (is_directory(p)) + if (is_directory(p, ec) && !ec.failed()) { boost::filesystem::directory_iterator end_iter; for (boost::filesystem::directory_iterator dir_itr(p); diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 93ff175967..0b8852d07c 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -4780,7 +4780,18 @@ void LLViewerWindow::saveImageLocal(LLImageFormatted *image, const snapshot_save #else boost::filesystem::path b_path(lastSnapshotDir); #endif - if (!boost::filesystem::is_directory(b_path)) + boost::system::error_code ec; + if (!boost::filesystem::is_directory(b_path, ec) || ec.failed()) + { + LLSD args; + args["PATH"] = lastSnapshotDir; + LLNotificationsUtil::add("SnapshotToLocalDirNotExist", args); + resetSnapshotLoc(); + failure_cb(); + return; + } + boost::filesystem::space_info b_space = boost::filesystem::space(b_path, ec); + if (ec.failed()) { LLSD args; args["PATH"] = lastSnapshotDir; @@ -4789,7 +4800,6 @@ void LLViewerWindow::saveImageLocal(LLImageFormatted *image, const snapshot_save failure_cb(); return; } - boost::filesystem::space_info b_space = boost::filesystem::space(b_path); if (b_space.free < image->getDataSize()) { LLSD args; @@ -4806,6 +4816,8 @@ void LLViewerWindow::saveImageLocal(LLImageFormatted *image, const snapshot_save LLNotificationsUtil::add("SnapshotToComputerFailed", args); failure_cb(); + + // Shouldn't there be a return here? } // Look for an unused file name |