From 8f833fed258098a8eec0287ff15ccabe6cf1080e Mon Sep 17 00:00:00 2001 From: Sidharth Surana Date: Tue, 15 Oct 2019 22:39:12 -0700 Subject: [PATCH] Fix the ordering of the APIVersion check to avoid nil pointer Signed-off-by: Sidharth Surana --- pkg/chart/loader/load.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/chart/loader/load.go b/pkg/chart/loader/load.go index 04105f9ac..f04c0e9b3 100644 --- a/pkg/chart/loader/load.go +++ b/pkg/chart/loader/load.go @@ -104,12 +104,12 @@ func LoadFiles(files []*BufferedFile) (*chart.Chart, error) { // Deprecated: requirements.yaml is deprecated use Chart.yaml. // We will handle it for you because we are nice people case f.Name == "requirements.yaml": - if c.Metadata.APIVersion != chart.APIVersionV1 { - log.Printf("Warning: Dependencies are handled in Chart.yaml since apiVersion \"v2\". We recommend migrating dependencies to Chart.yaml.") - } if c.Metadata == nil { c.Metadata = new(chart.Metadata) } + if c.Metadata.APIVersion != chart.APIVersionV1 { + log.Printf("Warning: Dependencies are handled in Chart.yaml since apiVersion \"v2\". We recommend migrating dependencies to Chart.yaml.") + } if err := yaml.Unmarshal(f.Data, c.Metadata); err != nil { return c, errors.Wrap(err, "cannot load requirements.yaml") }