fix(deps): catch git parse errors on Unmarshal (#79)

Fixes the nil pointer error that currently happens with
invalid URL.
This commit is contained in:
Paul Gier 2020-02-11 16:00:01 -06:00 committed by GitHub
parent 4a1cd85aca
commit efe0c9e864
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -68,6 +68,9 @@ func (gs *Git) UnmarshalJSON(data []byte) error {
} }
tmp := parseGit(j.Remote) tmp := parseGit(j.Remote)
if tmp == nil {
return fmt.Errorf("unable to parse git url `%s` ", j.Remote)
}
gs.Host = tmp.Source.GitSource.Host gs.Host = tmp.Source.GitSource.Host
gs.User = tmp.Source.GitSource.User gs.User = tmp.Source.GitSource.User
gs.Repo = tmp.Source.GitSource.Repo gs.Repo = tmp.Source.GitSource.Repo