Prevent panic when there are no cheats (#244)

Fixes #243
This commit is contained in:
Denis Isidoro 2020-03-12 23:32:28 -03:00 committed by GitHub
parent 95ed76f40c
commit 7f4fc90116
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 3 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.10"
version = "2.0.11"
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.10"
version = "2.0.11"
authors = ["Denis Isidoro <denis_isidoro@live.com>"]
edition = "2018"

View file

@ -140,7 +140,9 @@ pub fn read_all(config: &Config, stdin: &mut std::process::ChildStdin) -> HashMa
let mut fallback: String = String::from("");
let folders_str = config.path.as_ref().unwrap_or_else(|| {
fallback = filesystem::pathbuf_to_string(filesystem::cheat_pathbuf().unwrap());
if let Some(f) = filesystem::cheat_pathbuf() {
fallback = filesystem::pathbuf_to_string(f);
}
&fallback
});
let folders = folders_str.split(':');