fix(config): warn on mode without actions (#1035)

Log with a warning, if the user finds himself in a mode,
that has no action associated with it.

fix #949
This commit is contained in:
a-kenji 2022-01-31 16:24:06 +01:00 committed by GitHub
parent a0791e3504
commit c82ee774ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -198,7 +198,14 @@ impl Keybinds {
keybinds
.0
.get(mode)
.unwrap_or_else(|| unreachable!("Unrecognized mode: {:?}", mode))
.unwrap_or({
log::warn!(
"The following mode has no action associated with it: {:?}",
mode
);
// create a dummy mode to recover from
&ModeKeybinds::new()
})
.0
.get(key)
.cloned()