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

Commit

Permalink
refactor: set condition and bail out when the current value is nil
Browse files Browse the repository at this point in the history
  • Loading branch information
Igor Sutton committed Jul 21, 2021
1 parent 4678ea1 commit 6049589
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion pkg/reconcile/pipeline/handler/collect/impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,15 @@ func collectItems(prefix string, ctx pipeline.Context, service pipeline.Service,
p = ""
}
for _, n := range v.MapKeys() {
collectItems(p, ctx, service, n, v.MapIndex(n).Interface())
if mapVal := v.MapIndex(n).Interface(); mapVal != nil {
collectItems(p, ctx, service, n, mapVal)
} else {
condition := v1alpha1.Conditions().NotCollectionReady().
Msg(fmt.Sprintf("Value for key %v_%v not found", prefix+k.String(), n.String())).
Reason("ValueNotFound").Build()
ctx.SetCondition(condition)
return
}
}
case reflect.Slice:
for i := 0; i < v.Len(); i++ {
Expand Down

0 comments on commit 6049589

Please sign in to comment.