From 2c0b1758074c09c470aaa611aa92361c6d0e9a73 Mon Sep 17 00:00:00 2001 From: Hidde Beydals Date: Wed, 29 Apr 2020 16:45:25 +0200 Subject: [PATCH] controllers: check GitRepository reference != nil To prevent the reconciler from panicing when no reference is configured for the GitRepository. --- controllers/gitrepository_controller.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/controllers/gitrepository_controller.go b/controllers/gitrepository_controller.go index 77deb35a8..b8179af00 100644 --- a/controllers/gitrepository_controller.go +++ b/controllers/gitrepository_controller.go @@ -321,7 +321,7 @@ func (r *GitRepositoryReconciler) sync(ctx context.Context, repository sourcev1. if revision == "" { revision = fmt.Sprintf("%s/%s", branch, ref.Hash().String()) - if repository.Spec.Reference.Tag != "" { + if repository.Spec.Reference != nil && repository.Spec.Reference.Tag != "" { revision = fmt.Sprintf("%s/%s", repository.Spec.Reference.Tag, ref.Hash().String()) } }