music error fix

This commit is contained in:
Master Kwoth 2017-06-10 09:18:49 +02:00
parent b705a6ad11
commit c2230ac5eb

View File

@ -131,7 +131,14 @@ namespace NadekoBot.Services.Music
if (CurrentSong == null)
continue;
if (AudioClient == null || AudioClient.ConnectionState == ConnectionState.Disconnected || AudioClient.ConnectionState == ConnectionState.Disconnecting)
while (AudioClient?.ConnectionState == ConnectionState.Disconnecting ||
AudioClient?.ConnectionState == ConnectionState.Connecting)
{
_log.Info("Waiting for Audio client");
await Task.Delay(200).ConfigureAwait(false);
}
if (AudioClient == null || AudioClient.ConnectionState == ConnectionState.Disconnected)
AudioClient = await PlaybackVoiceChannel.ConnectAsync().ConfigureAwait(false);
var index = _playlist.IndexOf(CurrentSong);