浏览代码

update listviews

Luke Pulverenti 9 年之前
父节点
当前提交
08931dabff
共有 1 个文件被更改,包括 9 次插入6 次删除
  1. 9 6
      MediaBrowser.Server.Implementations/Playlists/PlaylistManager.cs

+ 9 - 6
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);
         }