Skip to content

Commit 903197d

Browse files
authored
fix potential nil dereferencing panic (#161)
1 parent 7f3201e commit 903197d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

pkg/component/reconciler.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,8 +228,11 @@ func (r *Reconciler[T]) Reconcile(ctx context.Context, req ctrl.Request) (result
228228
status.ProcessingDigest = ""
229229
status.ProcessingSince = nil
230230
}
231-
if status.State == StateProcessing && now.Sub(status.ProcessingSince.Time) >= timeout {
231+
if status.State == StateProcessing && err == nil && now.Sub(status.ProcessingSince.Time) >= timeout {
232232
// TODO: maybe it would be better to have a dedicated StateTimeout?
233+
// note: it is guaranteed that status.ProcessingSince is not nil here because
234+
// - it was not cleared above because of the mutually exclusive clauses on status.State and err
235+
// - it was set during reconcile when state was set to StateProcessing
233236
status.SetState(StateError, readyConditionReasonTimeout, "Reconcilation of dependent resources timed out")
234237
}
235238

0 commit comments

Comments
 (0)