mirror of
https://github.com/nushell/nushell
synced 2024-12-26 13:03:07 +00:00
fix color_config crashing on nonstring data (#7215)
This PR closses issue #7155, where now providing a non valid color will just ignore it and use the default. Making the same changes as the original issue just starts nushell without crashing.
This commit is contained in:
parent
0732d8bbba
commit
c3c3481ef5
1 changed files with 4 additions and 9 deletions
|
@ -217,15 +217,10 @@ pub fn get_color_config(config: &Config) -> HashMap<String, Style> {
|
|||
hm.insert("hints".to_string(), Color::DarkGray.normal());
|
||||
|
||||
for (key, value) in &config.color_config {
|
||||
let value = value
|
||||
.as_string()
|
||||
.expect("the only values for config color must be strings");
|
||||
update_hashmap(key, &value, &mut hm);
|
||||
|
||||
// eprintln!(
|
||||
// "config: {}:{}\t\t\thashmap: {}:{:?}",
|
||||
// &key, &value, &key, &hm[key]
|
||||
// );
|
||||
match value.as_string() {
|
||||
Ok(value) => update_hashmap(key, &value, &mut hm),
|
||||
Err(_) => continue,
|
||||
}
|
||||
}
|
||||
|
||||
hm
|
||||
|
|
Loading…
Reference in a new issue