Skip to content

Commit

Permalink
fix: check if paths array is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
timothebot committed Sep 17, 2024
1 parent 224ede9 commit 2d05f17
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/command/prompt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,12 @@ fn resolve_path_part(

/// select one of the given paths
fn choose_path(possible_paths: Vec<ScoredPath>) -> PathBuf {
if possible_paths.is_empty() {
return PathBuf::new();
}
if possible_paths.len() == 1 {
return possible_paths[0].0.clone();
}
let possible_paths_str: Vec<String> = possible_paths
.iter()
.map(|path| format!("{}: {}", path.1, path.0.to_str().unwrap()))
Expand Down

0 comments on commit 2d05f17

Please sign in to comment.