Fix nil ptr bug

This commit is contained in:
Jeffrey Regan
2019-02-06 17:11:43 -08:00
parent d720e9ef49
commit ccc4461827
2 changed files with 28 additions and 1 deletions

View File

@@ -267,7 +267,8 @@ func (l *fileLoader) errIfArgEqualOrHigher(
// path but a different tag?
func (l *fileLoader) errIfRepoCycle(newRepoSpec *git.RepoSpec) error {
// TODO(monopole): Use parsed data instead of Raw().
if strings.HasPrefix(l.repoSpec.Raw(), newRepoSpec.Raw()) {
if l.repoSpec != nil &&
strings.HasPrefix(l.repoSpec.Raw(), newRepoSpec.Raw()) {
return fmt.Errorf(
"cycle detected: URI '%s' referenced by previous URI '%s'",
newRepoSpec.Raw(), l.repoSpec.Raw())