Fixed crash on disconnect if multiserver is enabled
This commit is contained in:
@@ -50,7 +50,14 @@ namespace Discord.Audio
|
|||||||
if (Config.EnableMultiserver)
|
if (Config.EnableMultiserver)
|
||||||
{
|
{
|
||||||
var tasks = _voiceClients
|
var tasks = _voiceClients
|
||||||
.Select(x => x.Value.Disconnect())
|
.Select(x =>
|
||||||
|
{
|
||||||
|
var val = x.Value;
|
||||||
|
if (val != null)
|
||||||
|
return x.Value.Disconnect();
|
||||||
|
else
|
||||||
|
return TaskHelper.CompletedTask;
|
||||||
|
})
|
||||||
.ToArray();
|
.ToArray();
|
||||||
await Task.WhenAll(tasks).ConfigureAwait(false);
|
await Task.WhenAll(tasks).ConfigureAwait(false);
|
||||||
_voiceClients.Clear();
|
_voiceClients.Clear();
|
||||||
|
|||||||
Reference in New Issue
Block a user