From dfde51205ad9d23b005d36940794940cf11e30e8 Mon Sep 17 00:00:00 2001 From: khyernet Date: Tue, 30 Apr 2024 21:42:03 -0800 Subject: [PATCH] fix: prevent tcobalt from crashing when choosing an invalid picker index ahead-of-time --- src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index f7fabbc..215e867 100644 --- a/src/main.rs +++ b/src/main.rs @@ -195,7 +195,7 @@ async fn execute_get_media(args: Args, bulk: u16, debug: bool) -> bool { args.picker_choice }; - urls[(choice - 1) as usize].clone() + urls.get((choice - 1) as usize).unwrap_or(&urls[0]).clone() } else { json.get("url").unwrap().get_str().unwrap() };