Fixed User.Edit exception when null roles is passed

This commit is contained in:
RogueException
2016-01-01 20:58:08 -04:00
parent 120b3a1d61
commit ccedfd2326

View File

@@ -239,14 +239,18 @@ namespace Discord
if (Server == null) throw new InvalidOperationException("Unable to edit users in a private channel");
//Modify the roles collection and filter out the everyone role
var roleIds = roles == null ? null : roles.Where(x => !x.IsEveryone).Select(x => x.Id).Distinct();
var roleIds = roles == null ? null : roles
.Where(x => !x.IsEveryone)
.Select(x => x.Id)
.Distinct()
.ToArray();
var request = new UpdateMemberRequest(Server.Id, Id)
{
IsMuted = isMuted ?? IsServerMuted,
IsDeafened = isDeafened ?? IsServerDeafened,
VoiceChannelId = voiceChannel?.Id,
RoleIds = roleIds.ToArray()
RoleIds = roleIds
};
return Client.ClientAPI.Send(request);
}