From 21729fc8779eced0eaa776c17a2b81828d6b02cb Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Wed, 5 May 2021 07:38:40 +0200 Subject: [PATCH] Fix array indexing issue --- src/main.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 79736a8..c7e3cb1 100644 --- a/src/main.rs +++ b/src/main.rs @@ -86,7 +86,10 @@ async fn main() -> std::io::Result<()> { std::process::exit(-2); } - let args = &args[3..]; + let args = match args.len() { + 0 | 1 | 2 => vec![], + _ => (&args[3..]).to_vec() + }; let res = (selected_action.function)(args.to_vec()); res.expect("Failed to execute action!");