1
2
Fork 0
mirror of https://github.com/mat-1/azalea.git synced 2025-08-02 06:16:04 +00:00

fix panic in azalea-chat

This commit is contained in:
mat 2023-05-28 14:05:23 -05:00
parent 2a2169226f
commit bc7e0ab537

View file

@ -29,7 +29,7 @@ impl TextColor {
pub fn parse(value: String) -> Option<TextColor> {
if value.starts_with('#') {
let n = value.chars().skip(1).collect::<String>();
let n = u32::from_str_radix(&n, 16).unwrap();
let n = u32::from_str_radix(&n, 16).ok()?;
return Some(TextColor::from_rgb(n));
}
let color_option = NAMED_COLORS.get(&value.to_ascii_uppercase());