From deeb85f2962fdcfaf56e4e2e7f72aac8acb6efc3 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Fri, 5 Jul 2013 14:23:41 -0400 Subject: [PATCH] don't try to get non-cached children when offline --- MediaBrowser.Controller/Entities/BaseItem.cs | 10 +++++++++- MediaBrowser.Controller/Entities/Folder.cs | 4 +++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs index dff0203b9..0104db305 100644 --- a/MediaBrowser.Controller/Entities/BaseItem.cs +++ b/MediaBrowser.Controller/Entities/BaseItem.cs @@ -314,7 +314,15 @@ namespace MediaBrowser.Controller.Entities isDirectory = true; } - pathInfo = pathInfo ?? (isDirectory ? new DirectoryInfo(path) : FileSystem.GetFileSystemInfo(path)); + try + { + pathInfo = pathInfo ?? (isDirectory ? new DirectoryInfo(path) : FileSystem.GetFileSystemInfo(path)); + } + catch (IOException) + { + IsOffline = true; + throw; + } if (pathInfo == null || !pathInfo.Exists) { diff --git a/MediaBrowser.Controller/Entities/Folder.cs b/MediaBrowser.Controller/Entities/Folder.cs index e782717e9..8605c7125 100644 --- a/MediaBrowser.Controller/Entities/Folder.cs +++ b/MediaBrowser.Controller/Entities/Folder.cs @@ -646,7 +646,7 @@ namespace MediaBrowser.Controller.Entities cancellationToken.ThrowIfCancellationRequested(); //get the current valid children from filesystem (or wherever) - var nonCachedChildren = GetNonCachedChildren(); + var nonCachedChildren = IsOffline ? new BaseItem[] { } : GetNonCachedChildren(); if (nonCachedChildren == null) return; //nothing to validate @@ -722,6 +722,8 @@ namespace MediaBrowser.Controller.Entities else { item.IsOffline = true; + + validChildren.Add(new Tuple(item, false)); } }