From f43898dff030fb05c44d3f2bedde1980d983aef9 Mon Sep 17 00:00:00 2001 From: Fuwn Date: Sun, 17 Jul 2022 11:38:08 +0000 Subject: fix(input.rs): error handle url host --- src/input.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/input.rs b/src/input.rs index 56a4fd7..62f2b96 100644 --- a/src/input.rs +++ b/src/input.rs @@ -128,7 +128,13 @@ fn handle_normal_input( if !link.starts_with("gemini://") && link.contains("://") { } else { let the_url = &if link.starts_with('/') { - format!("gemini://{}{}", app.url.host_str().unwrap(), link) + if let Some(host) = app.url.host_str() { + format!("gemini://{}{}", host, link) + } else { + app.error = Some("URL has no host".to_string()); + + return false + } } else if link.starts_with("gemini://") { link.to_string() } else if !link.starts_with('/') && !link.starts_with("gemini://") { -- cgit v1.2.3