diff --git a/src/windows/common/wslutil.cpp b/src/windows/common/wslutil.cpp index ca87eff..c8e711d 100644 --- a/src/windows/common/wslutil.cpp +++ b/src/windows/common/wslutil.cpp @@ -594,6 +594,11 @@ std::wstring wsl::windows::common::wslutil::DownloadFile(std::wstring_view Url, void wsl::windows::common::wslutil::EnforceFileLimit(LPCWSTR Path, size_t Limit, const std::function& pred) { + if (Limit <= 0) + { + return; + } + std::map files; for (auto const& e : std::filesystem::directory_iterator{Path}) { @@ -603,7 +608,7 @@ void wsl::windows::common::wslutil::EnforceFileLimit(LPCWSTR Path, size_t Limit, } } - if (Limit < 0 || files.size() < Limit) + if (files.size() < Limit) { return; }