mirror of
https://github.com/hykilpikonna/hyfetch.git
synced 2026-03-21 17:24:51 -05:00
[F] Fix #460: Hyfetch panics upon entering invalid alignment option after roll
Some checks are pending
Shellcheck / check (push) Waiting to run
Some checks are pending
Shellcheck / check (push) Waiting to run
This commit is contained in:
parent
2dc18050ca
commit
9b376f97c0
|
|
@ -938,16 +938,19 @@ fn create_config(
|
|||
}
|
||||
|
||||
// Save choice
|
||||
color_align = arrangements
|
||||
.into_iter()
|
||||
.find_map(|(k, ca)| {
|
||||
if k.to_lowercase() == choice {
|
||||
Some(ca)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
})
|
||||
.expect("selected color alignment should be valid");
|
||||
color_align = if choice == "horizontal" { ColorAlignment::Horizontal }
|
||||
else if choice == "vertical" { ColorAlignment::Vertical }
|
||||
else {
|
||||
arrangements.into_iter()
|
||||
.find_map(|(k, ca)| {
|
||||
if k.to_lowercase() == choice {
|
||||
Some(ca)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
})
|
||||
.expect("selected color alignment is not valid") // TODO: it sould ask the user to retry instead of panicking
|
||||
};
|
||||
debug!(?color_align, "selected color alignment");
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user