Skip to content

Commit af1fea9

Browse files
committed
bug #2723 [Icons] Check for empty paths before calling Finder in ux:icons:lock (ameotoko)
This PR was merged into the 2.x branch. Discussion ---------- [Icons] Check for empty paths before calling Finder in `ux:icons:lock` | Q | A | ------------- | --- | Bug fix? | yes | Issues | Fix #2719 Commits ------- 6b42754 check for empty paths before calling Finder in `ux:icons:lock`
2 parents 0955577 + 6b42754 commit af1fea9

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/Icons/src/Twig/IconFinder.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,14 @@ public function icons(): array
6767
private function templateFiles(LoaderInterface $loader): iterable
6868
{
6969
if ($loader instanceof FilesystemLoader) {
70-
$paths = [];
70+
$paths = $loader->getPaths();
7171
foreach ($loader->getNamespaces() as $namespace) {
7272
$paths = [...$paths, ...$loader->getPaths($namespace)];
7373
}
74-
foreach ((new Finder())->files()->in($paths)->name('*.twig') as $file) {
75-
yield (string) $file;
74+
if ($paths) {
75+
foreach ((new Finder())->files()->in($paths)->name('*.twig') as $file) {
76+
yield (string) $file;
77+
}
7678
}
7779
}
7880

0 commit comments

Comments
 (0)