src/cli/command.rs: print_bash_completion - avoid crash
This commit is contained in:
parent
141f062e08
commit
25e77d3877
|
@ -574,12 +574,13 @@ pub fn print_bash_completion(def: &CommandLineInterface) {
|
||||||
Err(_) => return,
|
Err(_) => return,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
let mut args = match shellwords::split(&cmdline) {
|
let mut args = match shellwords::split(&cmdline) {
|
||||||
Ok(v) => v,
|
Ok(v) => v,
|
||||||
Err(_) => return,
|
Err(_) => return,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if args.len() == 0 { return; }
|
||||||
|
|
||||||
args.remove(0); //no need for program name
|
args.remove(0); //no need for program name
|
||||||
|
|
||||||
if cmdline.ends_with(char::is_whitespace) {
|
if cmdline.ends_with(char::is_whitespace) {
|
||||||
|
|
Loading…
Reference in New Issue