Archived
0
0
Fork 0

fix: crashing with unicode in user nick

This commit is contained in:
Daryl Ronningen 2021-12-23 18:55:02 -08:00
parent 600fa261b5
commit 70bbade763
Signed by: Daryl Ronningen
GPG key ID: FD23F0C934A5EC6B

View file

@ -258,7 +258,10 @@ namespace chord
foreach (var users in roles.Members) foreach (var users in roles.Members)
{ {
node.Children.Add(new TreeNode($"{users.Username}#{users.Discriminator} ({users.Nickname})")); var userName = Regex.Replace(users.Username, @"[^\u0000-\u007F]+", string.Empty);
var userNick = Regex.Replace(users.Nickname, @"[^\u0000-\u007F]+", string.Empty);
node.Children.Add(new TreeNode($"{userNick}#{users.Discriminator} ({userNick})"));
} }
rolesDict.Add(roles.Position, node); rolesDict.Add(roles.Position, node);