Skip to content

The Free Software Media System - Server Backend & API

Exit method early if there are no unique playlist items to add

Mark Monteiro6438771212cd
diff --git a/Emby.Server.Implementations/Playlists/PlaylistManager.cs b/Emby.Server.Implementations/Playlists/PlaylistManager.cs
index 78b29be43a..42d14a9e5b 100644
--- a/Emby.Server.Implementations/Playlists/PlaylistManager.cs
+++ b/Emby.Server.Implementations/Playlists/PlaylistManager.cs
@@ -214,6 +214,12 @@ namespace Emby.Server.Implementations.Playlists
_logger.LogWarning("Ignored adding {DuplicateCount} duplicate items to playlist {PlaylistName}.", numDuplicates, playlist.Name);
}
+ // Do nothing else if there are no items to add to the playlist
+ if (uniqueItems.Length == 0)
+ {
+ return;
+ }
+
// Create a new array with the updated playlist items
var newLinkedChildren = new LinkedChild[playlist.LinkedChildren.Length + uniqueItems.Length];
playlist.LinkedChildren.CopyTo(newLinkedChildren, 0);