aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Server.Implementations/Playlists
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2016-07-17 13:11:59 -0400
committerLuke Pulverenti <luke.pulverenti@gmail.com>2016-07-17 13:11:59 -0400
commit365b2d82b15bac2d652a57d562c9d9d1175f6179 (patch)
tree715c48e7530b3bd242c2b5bd3ae9e26a9525ec8b /MediaBrowser.Server.Implementations/Playlists
parent1c72aac1c2d6379127bc3c27eb6f243c22cea0e4 (diff)
parentdc264a2cf1568f1e439115b4426c1eefb5c46442 (diff)
Merge branch 'beta' of https://github.com/MediaBrowser/Emby into beta
Diffstat (limited to 'MediaBrowser.Server.Implementations/Playlists')
-rw-r--r--MediaBrowser.Server.Implementations/Playlists/PlaylistManager.cs15
1 files 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);
}