aboutsummaryrefslogtreecommitdiff
path: root/src/input.rs
diff options
context:
space:
mode:
authorFuwn <[email protected]>2022-07-17 11:38:08 +0000
committerFuwn <[email protected]>2022-07-17 11:38:08 +0000
commitf43898dff030fb05c44d3f2bedde1980d983aef9 (patch)
tree4d1b0682a22b147b81be9adfe3122af46963495d /src/input.rs
parentfix(input.rs): error handle open command (diff)
downloadsydney-f43898dff030fb05c44d3f2bedde1980d983aef9.tar.xz
sydney-f43898dff030fb05c44d3f2bedde1980d983aef9.zip
fix(input.rs): error handle url host
Diffstat (limited to 'src/input.rs')
-rw-r--r--src/input.rs8
1 files changed, 7 insertions, 1 deletions
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://") {