mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-11-15 18:08:53 -07:00
Update Emby.Server.Implementations/ScheduledTasks/Tasks/CleanupCollectionAndPlaylistPathsTask.cs
Co-authored-by: Bond-009 <bond.009@outlook.com>
This commit is contained in:
parent
783bb8a8cb
commit
fccea4625d
@ -112,17 +112,17 @@ public class CleanupCollectionAndPlaylistPathsTask : IScheduledTask
|
||||
private void CleanupLinkedChildren<T>(T folder, CancellationToken cancellationToken)
|
||||
where T : Folder
|
||||
{
|
||||
var itemsToRemove = new List<LinkedChild>();
|
||||
List<LinkedChild> itemsToRemove = null;
|
||||
foreach (var linkedChild in folder.LinkedChildren)
|
||||
{
|
||||
if (!File.Exists(folder.Path))
|
||||
{
|
||||
_logger.LogInformation("Item in {FolderName} cannot be found at {ItemPath}", folder.Name, linkedChild.Path);
|
||||
itemsToRemove.Add(linkedChild);
|
||||
(itemsToRemove ??= new List<LinkedChild>()).Add(linkedChild);
|
||||
}
|
||||
}
|
||||
|
||||
if (itemsToRemove.Count != 0)
|
||||
if (itemsToRemove is not null)
|
||||
{
|
||||
_logger.LogDebug("Updating {FolderName}", folder.Name);
|
||||
folder.LinkedChildren = folder.LinkedChildren.Except(itemsToRemove).ToArray();
|
||||
|
Loading…
Reference in New Issue
Block a user