diff --git a/internal/chart/v3/util/dependencies.go b/internal/chart/v3/util/dependencies.go index dd778d1d3..48584a6f9 100644 --- a/internal/chart/v3/util/dependencies.go +++ b/internal/chart/v3/util/dependencies.go @@ -223,11 +223,14 @@ Loop: // win on conflicts. if path != "" { if pt, err := cvals.Table(strings.TrimSuffix(path, ".")); err == nil { - if top, ok := cvals[t.Metadata.Name].(map[string]interface{}); ok { + if top, ok := cvals[t.Metadata.Name].(map[string]any); ok { if v, ok := pt[t.Metadata.Name]; ok && !istable(v) { slog.Warn("skipping nested path update: value is not a table", "path", path+t.Metadata.Name) } else { - nested, _ := v.(map[string]interface{}) + nested, _ := v.(map[string]any) + if nested == nil { + nested = map[string]any{} + } pt[t.Metadata.Name] = util.CoalesceTables(nested, top) } } diff --git a/pkg/chart/v2/util/dependencies.go b/pkg/chart/v2/util/dependencies.go index e92eb2348..38d1897cb 100644 --- a/pkg/chart/v2/util/dependencies.go +++ b/pkg/chart/v2/util/dependencies.go @@ -228,6 +228,9 @@ Loop: slog.Warn("skipping nested path update: value is not a table", "path", path+t.Metadata.Name) } else { nested, _ := v.(map[string]any) + if nested == nil { + nested = map[string]any{} + } pt[t.Metadata.Name] = util.CoalesceTables(nested, top) } } diff --git a/pkg/chart/v2/util/dependencies_test.go b/pkg/chart/v2/util/dependencies_test.go index da7e05778..0b60e0716 100644 --- a/pkg/chart/v2/util/dependencies_test.go +++ b/pkg/chart/v2/util/dependencies_test.go @@ -175,12 +175,12 @@ func TestDependencyEnabledAliasNestedConditionEnabled(t *testing.T) { // User-provided values override util.enabled=true via the full alias path. // Expected: util IS included in the output. c := loadChart(t, "testdata/alias-condition-nested") - vals := map[string]interface{}{ - "midchart": map[string]interface{}{ + vals := map[string]any{ + "midchart": map[string]any{ "enabled": true, - "leafchart": map[string]interface{}{ + "leafchart": map[string]any{ "enabled": true, - "util": map[string]interface{}{ + "util": map[string]any{ "enabled": true, }, },