Don't crash if a user has a repeated role
This commit is contained in:
@@ -258,11 +258,12 @@ namespace Discord
|
|||||||
}
|
}
|
||||||
private void UpdateRoles(IEnumerable<Role> roles)
|
private void UpdateRoles(IEnumerable<Role> roles)
|
||||||
{
|
{
|
||||||
Dictionary<long, Role> newRoles;
|
Dictionary<long, Role> newRoles = new Dictionary<long, Role>();
|
||||||
if (roles != null)
|
if (roles != null)
|
||||||
newRoles = roles.ToDictionary(x => x.Id, x => x);
|
{
|
||||||
else
|
foreach (var r in roles)
|
||||||
newRoles = new Dictionary<long, Role>();
|
newRoles[r.Id] = r;
|
||||||
|
}
|
||||||
|
|
||||||
if (_server.Id != null)
|
if (_server.Id != null)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user