diff options
| author | Bond-009 <bond.009@outlook.com> | 2021-07-27 21:46:30 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-07-27 21:46:30 +0200 |
| commit | 92c2d206093d2243223a4c37e86f3f1f56b5626e (patch) | |
| tree | f64a24293e0549819c89fd735ec6c55dffa97ee1 | |
| parent | 85e705d09efbda1630b419fab3a0065046b8de6d (diff) | |
| parent | a13a569ca46ce4f83de4e37dd70a00680d3c665e (diff) | |
Merge pull request #6355 from Bond-009/opt
EnsureLibraryFolder: Minor optimization
| -rw-r--r-- | Emby.Server.Implementations/Collections/CollectionManager.cs | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/Emby.Server.Implementations/Collections/CollectionManager.cs b/Emby.Server.Implementations/Collections/CollectionManager.cs index 4fc33e2ea..08acd1767 100644 --- a/Emby.Server.Implementations/Collections/CollectionManager.cs +++ b/Emby.Server.Implementations/Collections/CollectionManager.cs @@ -82,12 +82,10 @@ namespace Emby.Server.Implementations.Collections internal async Task<Folder> EnsureLibraryFolder(string path, bool createIfNeeded) { - var existingFolders = FindFolders(path) - .ToList(); - - if (existingFolders.Count > 0) + var existingFolder = FindFolders(path).FirstOrDefault(); + if (existingFolder != null) { - return existingFolders[0]; + return existingFolder; } if (!createIfNeeded) |
