aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/url.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/url.rs b/src/url.rs
index d635d6f..60a3d0e 100644
--- a/src/url.rs
+++ b/src/url.rs
@@ -16,6 +16,9 @@ pub enum Error {
#[error("URL has no fragment")]
NoFragment,
+
+ #[error("Unable to parse owner or repo")]
+ NoOwnerRepo,
}
#[derive(Debug)]
@@ -34,6 +37,10 @@ impl FromStr for SuggestionUrl {
.ok_or(Error::NoPath)?
.collect::<Vec<_>>();
+ if path.len() < 2 {
+ return Err(Error::NoOwnerRepo);
+ }
+
Ok(SuggestionUrl {
owner: path[0].to_owned(),
repo: path[1].to_owned(),