mirror of
https://github.com/FliegendeWurst/tmux-thumbs.git
synced 2024-11-08 15:30:37 +00:00
Defend unknown values
This commit is contained in:
parent
2c2d140796
commit
5a0226fc63
@ -60,6 +60,8 @@ impl<'a> Alphabet<'a> {
|
||||
pub fn get_alphabet(alphabet_name: &str) -> Alphabet {
|
||||
let alphabets: HashMap<&str, &str> = ALPHABETS.iter().cloned().collect();
|
||||
|
||||
alphabets.get(alphabet_name).expect(format!("Unknown alphabet: {}", alphabet_name).as_str()); // FIXME
|
||||
|
||||
Alphabet::new(alphabets[alphabet_name])
|
||||
}
|
||||
|
||||
|
@ -16,6 +16,8 @@ const COLORS: [(&'static str, Color); 9] = [
|
||||
pub fn get_color(color_name: &str) -> Color {
|
||||
let available_colors: HashMap<&str, Color> = COLORS.iter().cloned().collect();
|
||||
|
||||
available_colors.get(color_name).expect(format!("Unknown color: {}", color_name).as_str()); // FIXME
|
||||
|
||||
available_colors[&color_name]
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user