fix: Range of issues presented by analyzer (#2404)
This commit is contained in:
@@ -532,13 +532,10 @@ namespace Discord.WebSocket
|
||||
Features = model.Features;
|
||||
|
||||
var roles = new ConcurrentDictionary<ulong, SocketRole>(ConcurrentHashSet.DefaultConcurrencyLevel, (int)(model.Roles.Length * 1.05));
|
||||
if (model.Roles != null)
|
||||
for (int i = 0; i < model.Roles.Length; i++)
|
||||
{
|
||||
for (int i = 0; i < model.Roles.Length; i++)
|
||||
{
|
||||
var role = SocketRole.Create(this, state, model.Roles[i]);
|
||||
roles.TryAdd(role.Id, role);
|
||||
}
|
||||
var role = SocketRole.Create(this, state, model.Roles[i]);
|
||||
roles.TryAdd(role.Id, role);
|
||||
}
|
||||
_roles = roles;
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace Discord.WebSocket
|
||||
{
|
||||
foreach (var channel in resolved.Channels.Value)
|
||||
{
|
||||
SocketChannel socketChannel = guild != null
|
||||
var socketChannel = guild != null
|
||||
? guild.GetChannel(channel.Value.Id)
|
||||
: discord.GetChannel(channel.Value.Id);
|
||||
|
||||
@@ -69,7 +69,7 @@ namespace Discord.WebSocket
|
||||
}
|
||||
}
|
||||
|
||||
if (resolved.Roles.IsSpecified)
|
||||
if (resolved.Roles.IsSpecified && guild != null)
|
||||
{
|
||||
foreach (var role in resolved.Roles.Value)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user