fix: Possible NullReferenceException when receiving InvalidSession (#1695)

This commit is contained in:
Paulo
2020-11-25 14:27:26 -03:00
committed by GitHub
parent e3850e1e8f
commit 5213916903

View File

@@ -534,6 +534,8 @@ namespace Discord.WebSocket
_sessionId = null;
_lastSeq = 0;
if (_shardedClient != null)
{
await _shardedClient.AcquireIdentifyLockAsync(ShardId, _connection.CancelToken).ConfigureAwait(false);
try
{
@@ -544,6 +546,9 @@ namespace Discord.WebSocket
_shardedClient.ReleaseIdentifyLock();
}
}
else
await ApiClient.SendIdentifyAsync(shardID: ShardId, totalShards: TotalShards, guildSubscriptions: _guildSubscriptions, gatewayIntents: _gatewayIntents, presence: BuildCurrentStatus()).ConfigureAwait(false);
}
break;
case GatewayOpCode.Reconnect:
{