From 4e695311038cddf74f460c6f44137dc826d407fa Mon Sep 17 00:00:00 2001 From: Ske Date: Tue, 13 Aug 2019 21:49:43 +0200 Subject: [PATCH] Ignore invalid colors in member card --- PluralKit.Bot/Services/EmbedService.cs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/PluralKit.Bot/Services/EmbedService.cs b/PluralKit.Bot/Services/EmbedService.cs index a3e0d843..42bdd6a1 100644 --- a/PluralKit.Bot/Services/EmbedService.cs +++ b/PluralKit.Bot/Services/EmbedService.cs @@ -1,3 +1,4 @@ +using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; @@ -69,7 +70,18 @@ namespace PluralKit.Bot { var name = member.Name; if (system.Name != null) name = $"{member.Name} ({system.Name})"; - var color = member.Color?.ToDiscordColor() ?? Color.Default; + Color color; + try + { + color = member.Color?.ToDiscordColor() ?? Color.Default; + } + catch (ArgumentException) + { + // Bad API use can cause an invalid color string + // TODO: fix that in the API + // for now we just default to a blank color, yolo + color = Color.Default; + } var messageCount = await _members.MessageCount(member);