aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Monteiro <marknr.monteiro@protonmail.com>2020-03-03 17:48:11 +0100
committerMark Monteiro <marknr.monteiro@protonmail.com>2020-03-03 17:48:11 +0100
commit6438771212cd7e8b46a71d5b1a78d6e6c5d42f69 (patch)
tree039f7f2ecebaecf83361e4c62a4572b2f0253a96
parent4d32b59a0b0c1ce1709781760a4d623bd08c38a2 (diff)
Exit method early if there are no unique playlist items to add
-rw-r--r--Emby.Server.Implementations/Playlists/PlaylistManager.cs6
1 files changed, 6 insertions, 0 deletions
diff --git a/Emby.Server.Implementations/Playlists/PlaylistManager.cs b/Emby.Server.Implementations/Playlists/PlaylistManager.cs
index 78b29be43..42d14a9e5 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);