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 <madhupr007@gmail.com>
This commit is contained in:
Madhu Rajanna committed 2020-08-06 12:19:49 +05:30
1 parent 43b07ef9fb
commit 99cd310cd2
1 file changed
+3 -1
+3 -1
View File
@@ -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 {