Return on error to avoid dereference errors

This commit is contained in:
Christoph Sassenberg
2018-01-24 09:03:54 +01:00
parent 5819c61aa6
commit d9e71688fc

View File

@@ -199,10 +199,13 @@ func (c *InCommand) downloadFile(url, destPath string) error {
func (c *InCommand) resolveTagToCommitSHA(tag string) (string, error) {
reference, err := c.github.GetRef(tag)
if err != nil {
return "", err
}
if err != nil && *reference.Object.Type != "commit" {
if *reference.Object.Type != "commit" {
fmt.Fprintln(c.writer, "could not resolve tag '%s' to commit: returned type is not 'commit' - only lightweight tags are supported")
return "", nil
return "", err
}
return *reference.Object.SHA, err