diff --git a/src/config.rs b/src/config.rs index be55af0f..9099011a 100644 --- a/src/config.rs +++ b/src/config.rs @@ -384,6 +384,10 @@ fn parse_color_string(color_string: &str) -> Option { "Attempting to read hexadecimal color string: {}", color_string ); + if color_string.len() != 7 { + log::debug!("Could not parse hexadecimal string: {}", color_string); + return None; + } let r: u8 = u8::from_str_radix(&color_string[1..3], 16).ok()?; let g: u8 = u8::from_str_radix(&color_string[3..5], 16).ok()?; let b: u8 = u8::from_str_radix(&color_string[5..7], 16).ok()?; @@ -591,6 +595,24 @@ mod tests { assert_eq!(