Skip to content

Commit 2c0b175

Browse files
committed
controllers: check GitRepository reference != nil
To prevent the reconciler from panicing when no reference is configured for the GitRepository.
1 parent af77de1 commit 2c0b175

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

controllers/gitrepository_controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ func (r *GitRepositoryReconciler) sync(ctx context.Context, repository sourcev1.
321321

322322
if revision == "" {
323323
revision = fmt.Sprintf("%s/%s", branch, ref.Hash().String())
324-
if repository.Spec.Reference.Tag != "" {
324+
if repository.Spec.Reference != nil && repository.Spec.Reference.Tag != "" {
325325
revision = fmt.Sprintf("%s/%s", repository.Spec.Reference.Tag, ref.Hash().String())
326326
}
327327
}

0 commit comments

Comments
 (0)