From efe0c9e864431e93d5c3376bd5931d0fb9b2a296 Mon Sep 17 00:00:00 2001 From: Paul Gier Date: Tue, 11 Feb 2020 16:00:01 -0600 Subject: [PATCH] fix(deps): catch git parse errors on `Unmarshal` (#79) Fixes the nil pointer error that currently happens with invalid URL. --- spec/deps/git.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/spec/deps/git.go b/spec/deps/git.go index 0061b4a..9713718 100644 --- a/spec/deps/git.go +++ b/spec/deps/git.go @@ -68,6 +68,9 @@ func (gs *Git) UnmarshalJSON(data []byte) error { } 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.User = tmp.Source.GitSource.User gs.Repo = tmp.Source.GitSource.Repo