From 470733b3238ed692de62e9efbf6952ea8cbe82f3 Mon Sep 17 00:00:00 2001 From: Patrick Thomson Date: Wed, 30 Sep 2020 15:49:42 -0400 Subject: [PATCH] Fix crash when nonexistent files were passed to `parse`. We were unwrapping the result of counting the characters in the vector returned by collect_files(), which, if that vector is empty, returns None. The most correct behavior is to halt if a nonexistent filename was provided or a glob failed. --- cli/src/main.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cli/src/main.rs b/cli/src/main.rs index 620f329f..0b470c74 100644 --- a/cli/src/main.rs +++ b/cli/src/main.rs @@ -426,6 +426,10 @@ fn collect_paths<'a>( } } + if result.is_empty() { + Error::err("No files were found at or matched by the provided pathname/glob".to_string())?; + } + return Ok(result); }