From 4d04f51251c4d5af5139eb44450cc457df152d37 Mon Sep 17 00:00:00 2001 From: SinTan1729 Date: Sun, 21 May 2023 16:47:06 -0500 Subject: [PATCH] fix: Gracefully exit after user cancellation --- src/functions.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/functions.rs b/src/functions.rs index c1ea0e6..ef20373 100644 --- a/src/functions.rs +++ b/src/functions.rs @@ -95,12 +95,18 @@ pub async fn process_file( } // Choose from the possible entries - let choice = Select::new( + let choice = match Select::new( format!(" Possible choices for {}:", file_base).as_str(), movie_list, ) .prompt() - .expect(" Invalid choice!"); + { + Ok(movie) => movie, + Err(error) => { + println!(" {error}"); + return ("".to_string(), true); + } + }; // Handle the case for subtitle files let mut is_subtitle = false;