src/cli/command.rs: print_bash_completion - avoid crash

This commit is contained in:
Dietmar Maurer 2019-03-07 12:14:26 +01:00
parent 141f062e08
commit 25e77d3877
1 changed files with 2 additions and 1 deletions

View File

@ -574,12 +574,13 @@ pub fn print_bash_completion(def: &CommandLineInterface) {
Err(_) => return,
};
let mut args = match shellwords::split(&cmdline) {
Ok(v) => v,
Err(_) => return,
};
if args.len() == 0 { return; }
args.remove(0); //no need for program name
if cmdline.ends_with(char::is_whitespace) {