Potential fix for concurrent list modification error

This commit is contained in:
Ske 2020-07-14 22:24:13 +02:00
parent 17826246f2
commit e7f95c9ba6

View File

@ -64,7 +64,7 @@ namespace PluralKit.Bot
{ {
var roleIdCache = _roleIdsField.GetValue(member) as List<ulong>; var roleIdCache = _roleIdsField.GetValue(member) as List<ulong>;
var currentRoleIds = member.Roles.Where(x => x != null).Select(x => x.Id); var currentRoleIds = member.Roles.Where(x => x != null).Select(x => x.Id);
var invalidRoleIds = roleIdCache.Where(x => !currentRoleIds.Contains(x)); var invalidRoleIds = roleIdCache.Where(x => !currentRoleIds.Contains(x)).ToList();
roleIdCache.RemoveAll(x => invalidRoleIds.Contains(x)); roleIdCache.RemoveAll(x => invalidRoleIds.Contains(x));
} }