Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 2298240

Browse files
Check for a valid SkSL cache directory before calling VisitFiles (#21118)
The directory may be invalid when running shell_unittests because some tests call SetCacheDirectoryPath and then delete the directory. Later tests that try to use that cache base path will be unable to open the directory.
1 parent 6e4af80 commit 2298240

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

shell/common/persistent_cache.cc

+3-1
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,9 @@ std::vector<PersistentCache::SkSLCache> PersistentCache::LoadSkSLs() {
194194
// opened directory (https://github.com/flutter/flutter/issues/65258).
195195
fml::UniqueFD fresh_dir =
196196
fml::OpenDirectoryReadOnly(*cache_directory_, kSkSLSubdirName);
197-
fml::VisitFiles(fresh_dir, visitor);
197+
if (fresh_dir.is_valid()) {
198+
fml::VisitFiles(fresh_dir, visitor);
199+
}
198200
}
199201

200202
std::unique_ptr<fml::Mapping> mapping = nullptr;

0 commit comments

Comments
 (0)