From e9aa6aa6863bb214db66b5f1d24a7cddc4b78d41 Mon Sep 17 00:00:00 2001 From: Weston Haught Date: Tue, 19 May 2020 08:48:57 -0700 Subject: [PATCH] add nil check to postprocess (#1343) * add nil check * separate the two warnings * inline top-level condition --- reconciler/reconcile_common.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/reconciler/reconcile_common.go b/reconciler/reconcile_common.go index 8af08f61a..cc0e2d712 100644 --- a/reconciler/reconcile_common.go +++ b/reconciler/reconcile_common.go @@ -48,8 +48,9 @@ func PostProcessReconcile(ctx context.Context, resource duckv1.KRShaped) { // generation regardless of success or failure. newStatus.ObservedGeneration = resource.GetGeneration() - rc := mgr.GetTopLevelCondition() - if rc.Reason == failedGenerationBump { + if rc := mgr.GetTopLevelCondition(); rc == nil { + logger.Warn("A reconciliation included no top-level condition") + } else if rc.Reason == failedGenerationBump { logger.Warn("A reconciler observed a new generation without updating the resource status") } }