Skip to content

Commit add409e

Browse files
OngyMarkus Ongyerth
and
Markus Ongyerth
authored
fix: Prevent segfault with empty kustomization (#1020)
Signed-off-by: Markus Ongyerth <[email protected]> Co-authored-by: Markus Ongyerth <[email protected]>
1 parent 597aaa9 commit add409e

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

pkg/argocd/git.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,8 +337,18 @@ func writeKustomization(app *v1alpha1.Application, wbc *WriteBackConfig, gitC gi
337337
if kustFile == "" {
338338
return fmt.Errorf("could not find kustomization in %s", base), false
339339
}
340+
source := getApplicationSource(app)
341+
if source == nil {
342+
return fmt.Errorf("failed to find source for kustomization in %s", base), false
343+
}
344+
345+
kustomize := source.Kustomize
346+
images := v1alpha1.KustomizeImages{}
347+
if kustomize != nil {
348+
images = kustomize.Images
349+
}
340350

341-
filterFunc, err := imagesFilter(getApplicationSource(app).Kustomize.Images)
351+
filterFunc, err := imagesFilter(images)
342352
if err != nil {
343353
return err, false
344354
}

0 commit comments

Comments
 (0)