Merge pull request #236 from austinjones/fix-badcmd

Fix crash when user enters a command that doesn't match any cheats
This commit is contained in:
Denis Isidoro 2020-03-12 17:44:05 -03:00 committed by GitHub
commit 8d0c82c8a2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 4 deletions

2
Cargo.lock generated
View file

@ -89,7 +89,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "navi"
version = "2.0.6"
version = "2.0.7"
dependencies = [
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"raw_tty 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",

View file

@ -1,6 +1,6 @@
[package]
name = "navi"
version = "2.0.6"
version = "2.0.7"
authors = ["Denis Isidoro <denis_isidoro@live.com>"]
edition = "2018"

View file

@ -42,13 +42,16 @@ fn extract_from_selections(raw_output: &str, contains_key: bool) -> (&str, &str,
} else {
"enter"
};
let mut parts = lines.next().unwrap().split(display::DELIMITER);
parts.next();
parts.next();
parts.next();
let tags = parts.next().unwrap();
let tags = parts.next().unwrap_or("");
parts.next();
let snippet = parts.next().unwrap();
let snippet = parts.next().unwrap_or("");
(key, tags, snippet)
}