From 12fc352c790d94d9bc3875699daa26a734a6ab05 Mon Sep 17 00:00:00 2001 From: aalexand Date: Wed, 14 Aug 2024 16:54:38 +0300 Subject: [PATCH] fix: cluster-registry-sync-manager nil pointer dereference --- pkg/sync/manager/controller.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pkg/sync/manager/controller.go b/pkg/sync/manager/controller.go index 87415ea..f816ca3 100644 --- a/pkg/sync/manager/controller.go +++ b/pkg/sync/manager/controller.go @@ -325,9 +325,12 @@ func (c *SyncController) hasDifferentHash(object runtime.Object) bool { instance := object.(*registryv1alpha1.ClusterSync) oldHash := instance.Status.SyncedDataHash - newHash := ptr.To(hash(instance.Status.SyncedData)) - return *oldHash != *newHash + if oldHash == nil || instance.Status.SyncedData == nil { + return true + } + + return *oldHash != hash(instance.Status.SyncedData) } func (c *SyncController) updateStatus(ctx context.Context, instance *registryv1alpha1.ClusterSync) error {