shortcut!: prevent panic if shortcut key $section is missing
parent
f6d5c968ea
commit
315af9bc05
|
@ -27,9 +27,9 @@ use melib::{MeliError, Result};
|
|||
#[macro_export]
|
||||
macro_rules! shortcut {
|
||||
($key:ident == $shortcuts:ident[$section:expr][$val:literal]) => {
|
||||
$shortcuts[$section]
|
||||
.get($val)
|
||||
.map(|v| v == $key)
|
||||
$shortcuts
|
||||
.get($section)
|
||||
.and_then(|s| s.get($val).map(|v| v == $key))
|
||||
.unwrap_or(false)
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue