Fix panics due to unwrap on Option::None

This commit is contained in:
Mario Krehl 2016-09-07 10:12:55 +02:00
parent d19243e7a8
commit 5ea5f588a9

View file

@ -170,7 +170,11 @@ fn main() {
match matches.subcommand() { match matches.subcommand() {
(subcommand, Some(scmd)) => { (subcommand, Some(scmd)) => {
let subcommand_args : Vec<&str> = scmd.values_of("").unwrap().collect(); debug!("Calling with subcommand: {}", subcommand);
let subcommand_args : Vec<&str> = match scmd.values_of("") {
Some(values) => values.collect(),
None => Vec::new()
};
debug!("Calling 'imag-{}' with args: {:?}", subcommand, subcommand_args); debug!("Calling 'imag-{}' with args: {:?}", subcommand, subcommand_args);
match Command::new(format!("imag-{}", subcommand)) match Command::new(format!("imag-{}", subcommand))