diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2013-06-20 14:07:58 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2013-06-20 14:07:58 -0400 |
| commit | 8ccc871d72759cd43b12062881273aaaeee1ae15 (patch) | |
| tree | 4e961f9c698ec1091f96d23ef13182f9e44857f4 | |
| parent | 1fe32171cdc7853233328cfa86f47be7abe7f93a (diff) | |
added error handling to collection folder
| -rw-r--r-- | MediaBrowser.Controller/Entities/CollectionFolder.cs | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/MediaBrowser.Controller/Entities/CollectionFolder.cs b/MediaBrowser.Controller/Entities/CollectionFolder.cs index b6b4a82e9..fa285a85f 100644 --- a/MediaBrowser.Controller/Entities/CollectionFolder.cs +++ b/MediaBrowser.Controller/Entities/CollectionFolder.cs @@ -1,5 +1,4 @@ -using MediaBrowser.Common.Extensions; -using System; +using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.IO; @@ -7,6 +6,7 @@ using System.Linq; using System.Runtime.Serialization; using System.Threading; using System.Threading.Tasks; +using MediaBrowser.Controller.Library; namespace MediaBrowser.Controller.Entities { @@ -73,11 +73,23 @@ namespace MediaBrowser.Controller.Entities { get { + ItemResolveArgs resolveArgs; + + try + { + resolveArgs = ResolveArgs; + } + catch (IOException ex) + { + Logger.ErrorException("Error getting ResolveArgs for {0}", ex, Path); + return new ConcurrentDictionary<Guid, BaseItem>(); + } var ourChildren = LibraryManager.RootFolder.RecursiveChildren - .Where(i => i is Folder && i.Path != null && ResolveArgs.PhysicalLocations.Contains(i.Path, StringComparer.OrdinalIgnoreCase)) - .Cast<Folder>().SelectMany(c => c.Children); + .OfType<Folder>() + .Where(i => i.Path != null && resolveArgs.PhysicalLocations.Contains(i.Path, StringComparer.OrdinalIgnoreCase)) + .SelectMany(c => c.Children); return new ConcurrentDictionary<Guid,BaseItem>(ourChildren.ToDictionary(i => i.Id)); } |
