mirror of
https://github.com/nushell/nushell
synced 2024-12-27 05:23:11 +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());
|
hm.insert("hints".to_string(), Color::DarkGray.normal());
|
||||||
|
|
||||||
for (key, value) in &config.color_config {
|
for (key, value) in &config.color_config {
|
||||||
let value = value
|
match value.as_string() {
|
||||||
.as_string()
|
Ok(value) => update_hashmap(key, &value, &mut hm),
|
||||||
.expect("the only values for config color must be strings");
|
Err(_) => continue,
|
||||||
update_hashmap(key, &value, &mut hm);
|
}
|
||||||
|
|
||||||
// eprintln!(
|
|
||||||
// "config: {}:{}\t\t\thashmap: {}:{:?}",
|
|
||||||
// &key, &value, &key, &hm[key]
|
|
||||||
// );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
hm
|
hm
|
||||||
|
|
Loading…
Reference in a new issue