Skip to content
This repository was archived by the owner on Jun 26, 2024. It is now read-only.

Commit 6049589

Browse files
author
Igor Sutton
committed
refactor: set condition and bail out when the current value is nil
1 parent 4678ea1 commit 6049589

File tree

1 file changed

+9
-1
lines changed
  • pkg/reconcile/pipeline/handler/collect

1 file changed

+9
-1
lines changed

pkg/reconcile/pipeline/handler/collect/impl.go

+9-1
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,15 @@ func collectItems(prefix string, ctx pipeline.Context, service pipeline.Service,
223223
p = ""
224224
}
225225
for _, n := range v.MapKeys() {
226-
collectItems(p, ctx, service, n, v.MapIndex(n).Interface())
226+
if mapVal := v.MapIndex(n).Interface(); mapVal != nil {
227+
collectItems(p, ctx, service, n, mapVal)
228+
} else {
229+
condition := v1alpha1.Conditions().NotCollectionReady().
230+
Msg(fmt.Sprintf("Value for key %v_%v not found", prefix+k.String(), n.String())).
231+
Reason("ValueNotFound").Build()
232+
ctx.SetCondition(condition)
233+
return
234+
}
227235
}
228236
case reflect.Slice:
229237
for i := 0; i < v.Len(); i++ {

0 commit comments

Comments
 (0)