diff options
| author | Robert Schumacher <roschuma@microsoft.com> | 2018-02-03 21:24:30 -0800 |
|---|---|---|
| committer | Robert Schumacher <roschuma@microsoft.com> | 2018-02-03 21:24:30 -0800 |
| commit | 0ef1bbb38cf187064e55bcab50de5012e502b3af (patch) | |
| tree | 7d9267af1bde8a148bda8e585c72ddf8b73c5588 | |
| parent | 6609d3d32efeaa4c8a8100abfc8571e5d19e98ff (diff) | |
| download | vcpkg-0ef1bbb38cf187064e55bcab50de5012e502b3af.tar.gz vcpkg-0ef1bbb38cf187064e55bcab50de5012e502b3af.zip | |
[vcpkg] Fix crash when trying to enumerate nonexistent directory.
| -rw-r--r-- | toolsrc/src/vcpkg/base/files.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/toolsrc/src/vcpkg/base/files.cpp b/toolsrc/src/vcpkg/base/files.cpp index 8c9e137ed..060a14da3 100644 --- a/toolsrc/src/vcpkg/base/files.cpp +++ b/toolsrc/src/vcpkg/base/files.cpp @@ -74,6 +74,7 @@ namespace vcpkg::Files std::error_code ec; fs::stdfs::recursive_directory_iterator b(dir, ec), e{}; + if (ec) return ret; for (; b != e; ++b) { ret.push_back(b->path()); @@ -86,7 +87,9 @@ namespace vcpkg::Files { std::vector<fs::path> ret; - fs::stdfs::directory_iterator b(dir), e{}; + std::error_code ec; + fs::stdfs::directory_iterator b(dir, ec), e{}; + if (ec) return ret; for (; b != e; ++b) { ret.push_back(b->path()); |
