aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Server.Implementations/Library/LibraryManager.cs
diff options
context:
space:
mode:
Diffstat (limited to 'MediaBrowser.Server.Implementations/Library/LibraryManager.cs')
-rw-r--r--MediaBrowser.Server.Implementations/Library/LibraryManager.cs19
1 files changed, 5 insertions, 14 deletions
diff --git a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs b/MediaBrowser.Server.Implementations/Library/LibraryManager.cs
index 14b22a24c..db14dc83f 100644
--- a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs
+++ b/MediaBrowser.Server.Implementations/Library/LibraryManager.cs
@@ -623,29 +623,20 @@ namespace MediaBrowser.Server.Implementations.Library
public List<T> ResolvePaths<T>(IEnumerable<FileSystemInfo> files, IDirectoryService directoryService, Folder parent, string collectionType = null)
where T : BaseItem
{
- var list = new List<T>();
-
- Parallel.ForEach(files, f =>
+ return files.Select(f =>
{
try
{
- var item = ResolvePath(f, directoryService, parent, collectionType) as T;
-
- if (item != null)
- {
- lock (list)
- {
- list.Add(item);
- }
- }
+ return ResolvePath(f, directoryService, parent, collectionType) as T;
}
catch (Exception ex)
{
_logger.ErrorException("Error resolving path {0}", ex, f.FullName);
+ return null;
}
- });
- return list;
+ }).Where(i => i != null)
+ .ToList();
}
/// <summary>