From 34b56c635368ffcd6ed107658a8a2a27d5602a36 Mon Sep 17 00:00:00 2001 From: Master Kwoth Date: Mon, 10 Jul 2017 21:31:47 +0200 Subject: [PATCH] Fixed .srm, closes #1373 --- src/NadekoBot/Services/Music/MusicPlayer.cs | 3 ++- src/NadekoBot/Services/Music/MusicQueue.cs | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/NadekoBot/Services/Music/MusicPlayer.cs b/src/NadekoBot/Services/Music/MusicPlayer.cs index 5c698fb3..a6b0cbfb 100644 --- a/src/NadekoBot/Services/Music/MusicPlayer.cs +++ b/src/NadekoBot/Services/Music/MusicPlayer.cs @@ -480,9 +480,10 @@ namespace NadekoBot.Services.Music lock (locker) { var cur = Queue.Current; + var toReturn = Queue.RemoveAt(index); if (cur.Index == index) Next(); - return Queue.RemoveAt(index); + return toReturn; } } diff --git a/src/NadekoBot/Services/Music/MusicQueue.cs b/src/NadekoBot/Services/Music/MusicQueue.cs index 50135b72..681f3936 100644 --- a/src/NadekoBot/Services/Music/MusicQueue.cs +++ b/src/NadekoBot/Services/Music/MusicQueue.cs @@ -95,11 +95,12 @@ namespace NadekoBot.Services.Music if (index < 0 || index >= Songs.Count) throw new ArgumentOutOfRangeException(nameof(index)); - var current = Songs.First; + var current = Songs.First.Value; for (int i = 0; i < Songs.Count; i++) { if (i == index) { + current = Songs.ElementAt(index); Songs.Remove(current); if (CurrentIndex != 0) { @@ -111,7 +112,7 @@ namespace NadekoBot.Services.Music break; } } - return current.Value; + return current; } }