From 99cd310cd2953364c6f4ed4de24e6a8a2b20e11c Mon Sep 17 00:00:00 2001 From: Madhu Rajanna Date: Wed, 5 Aug 2020 21:03:58 +0530 Subject: [PATCH] ceph: add check for nil object status in couple of unit testing the tests are panicing with nil pointer exception,This commit adds a check for status pointer before operating on it. Signed-off-by: Madhu Rajanna --- pkg/operator/ceph/object/status.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/operator/ceph/object/status.go b/pkg/operator/ceph/object/status.go index 9d77e6f5a..09c78ff46 100644 --- a/pkg/operator/ceph/object/status.go +++ b/pkg/operator/ceph/object/status.go @@ -69,7 +69,9 @@ func updateStatusBucket(client client.Client, name types.NamespacedName, phase c logger.Warningf("failed to retrieve object store %q to update status to %v. %v", name, phase, err) return } - + if objectStore.Status == nil { + objectStore.Status = &cephv1.ObjectStoreStatus{} + } objectStore.Status.BucketStatus = toCustomResourceStatus(objectStore.Status.BucketStatus, details, phase) objectStore.Status.Phase = phase if err := opcontroller.UpdateStatus(client, objectStore); err != nil {