Skip to content

Commit 7ec4e61

Browse files
authored
Merge pull request #224 from DavidKorczynski/nil-deref-fix
Fix nil-dereference in controller
2 parents a5aafca + 5a831a8 commit 7ec4e61

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

controllers/imageupdateautomation_controller.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,8 @@ func (r *ImageUpdateAutomationReconciler) Reconcile(ctx context.Context, req ctr
211211
// Here's where it gets constrained. If there's no push branch
212212
// given, then the checkout ref must include a branch, and
213213
// that can be used.
214-
if ref.Branch == "" {
215-
failWithError(fmt.Errorf("Push branch not given explicitly, and cannot be inferred from .spec.git.checkout.ref or GitRepository .spec.ref"))
214+
if ref == nil || ref.Branch == "" {
215+
return failWithError(fmt.Errorf("Push branch not given explicitly, and cannot be inferred from .spec.git.checkout.ref or GitRepository .spec.ref"))
216216
}
217217
pushBranch = ref.Branch
218218
tracelog.Info("using push branch from $ref.branch", "branch", pushBranch)

0 commit comments

Comments
 (0)