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
1 changed files with 5 additions and 1 deletions

View File

@ -170,7 +170,11 @@ fn main() {
match matches.subcommand() {
(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);
match Command::new(format!("imag-{}", subcommand))