diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/url.rs | 7 | 
1 files changed, 7 insertions, 0 deletions
| @@ -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(), | 
