From 5ea5f588a964e46fefcac1efabb7f241c719f7ac Mon Sep 17 00:00:00 2001 From: Mario Krehl Date: Wed, 7 Sep 2016 10:12:55 +0200 Subject: [PATCH] Fix panics due to unwrap on Option::None --- bin/src/main.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bin/src/main.rs b/bin/src/main.rs index 25d47ce3..12af035e 100644 --- a/bin/src/main.rs +++ b/bin/src/main.rs @@ -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))