fix(pkg): add nil-checks

Signed-off-by: Julian Siebert <j.siebert@micromata.de>
pull/31847/head
Julian Siebert 2 weeks ago
parent 5bd8aa1943
commit ab717bd6d7

@ -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)
}
}

@ -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)
}
}

@ -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,
},
},

Loading…
Cancel
Save