Fix panic when using multi-level key mapping

pull/924/head
Nehliin 3 years ago committed by Blaž Hrastnik
parent 5501669f8c
commit fbba47fbc0

@ -140,7 +140,7 @@ impl KeyTrieNode {
} }
} }
body.sort_unstable_by_key(|(_, keys)| { body.sort_unstable_by_key(|(_, keys)| {
self.order.iter().position(|&k| k == keys[0]).unwrap() self.order.iter().position(|&k| k == keys[0]).unwrap_or(0)
}); });
let prefix = format!("{} ", self.name()); let prefix = format!("{} ", self.name());
if body.iter().all(|(desc, _)| desc.starts_with(&prefix)) { if body.iter().all(|(desc, _)| desc.starts_with(&prefix)) {

Loading…
Cancel
Save