add nil check to postprocess (#1343)

* add nil check

* separate the two warnings

* inline top-level condition
This commit is contained in:
Weston Haught 2020-05-19 08:48:57 -07:00 committed by GitHub
parent 3afddc40ce
commit e9aa6aa686
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -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")
}
}