From 08931dabff86212390fc3f25d04baad0e15b03e1 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sat, 16 Jul 2016 14:02:39 -0400 Subject: [PATCH] update listviews --- .../Playlists/PlaylistManager.cs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/MediaBrowser.Server.Implementations/Playlists/PlaylistManager.cs b/MediaBrowser.Server.Implementations/Playlists/PlaylistManager.cs index 53c03b91c1..ba1559bd03 100644 --- a/MediaBrowser.Server.Implementations/Playlists/PlaylistManager.cs +++ b/MediaBrowser.Server.Implementations/Playlists/PlaylistManager.cs @@ -247,15 +247,18 @@ namespace MediaBrowser.Server.Implementations.Playlists return; } - if (newIndex > oldIndex) - { - newIndex--; - } - var item = playlist.LinkedChildren[oldIndex]; playlist.LinkedChildren.Remove(item); - playlist.LinkedChildren.Insert(newIndex, item); + + if (newIndex >= playlist.LinkedChildren.Count) + { + playlist.LinkedChildren.Add(item); + } + else + { + playlist.LinkedChildren.Insert(newIndex, item); + } await playlist.UpdateToRepository(ItemUpdateType.MetadataEdit, CancellationToken.None).ConfigureAwait(false); }