From e2e5a8ef3207e4a8e1172a5b3ffeacbdd063cd79 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Mon, 9 May 2016 11:41:56 -0400 Subject: [PATCH] fix refresh --- MediaBrowser.Providers/Manager/MetadataService.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/MediaBrowser.Providers/Manager/MetadataService.cs b/MediaBrowser.Providers/Manager/MetadataService.cs index 330b81374..a0c6bd889 100644 --- a/MediaBrowser.Providers/Manager/MetadataService.cs +++ b/MediaBrowser.Providers/Manager/MetadataService.cs @@ -444,9 +444,10 @@ namespace MediaBrowser.Providers.Manager var folder = item as Folder; if (folder != null && folder.SupportsDateLastMediaAdded) { - var date = folder.GetRecursiveChildren(i => !i.IsFolder).Select(i => i.DateCreated).Max(); + var items = folder.GetRecursiveChildren(i => !i.IsFolder).Select(i => i.DateCreated).ToList(); + var date = items.Count == 0 ? (DateTime?)null : items.Max(); - if (!folder.DateLastMediaAdded.HasValue || folder.DateLastMediaAdded.Value != date) + if ((!folder.DateLastMediaAdded.HasValue && date.HasValue) || folder.DateLastMediaAdded != date) { folder.DateLastMediaAdded = date; updateType = ItemUpdateType.MetadataEdit;