fix: Gracefully exit after user cancellation

This commit is contained in:
Sayantan Santra 2023-05-21 16:47:06 -05:00
parent 02fea4a71c
commit 4d04f51251
Signed by: SinTan1729
GPG key ID: EB3E68BFBA25C85F

View file

@ -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;