Settings: handle invalid Unicode label colours gracefully

Use checked hex slices so prefs.set follows the existing invalid-colour fallback when a component splits a UTF-8 character. Cover invalid Unicode placements and valid mixed-case colours through the command.

Co-Authored-By: OpenAI Codex <noreply@openai.com>
This commit is contained in:
storybored379
2026-10-06 09:58:59 -07:00
co-authored by OpenAI Codex
parent 588d269d29
commit 202417dab3
2 changed files with 14 additions and 1 deletions
+1 -1
View File
@@ -262,7 +262,7 @@ fn parse_hex(s: &str) -> Option<[u8; 3]> {
if h.len() != 6 {
return None;
}
let p = |i: usize| u8::from_str_radix(&h[i..i + 2], 16).ok();
let p = |i: usize| u8::from_str_radix(h.get(i..i + 2)?, 16).ok();
Some([p(0)?, p(2)?, p(4)?])
}