From 287fe185f224f4f749d1a32d0318f919019271f0 Mon Sep 17 00:00:00 2001 From: t00605665 Date: Mon, 23 Mar 2026 19:24:27 +0800 Subject: [PATCH] [Fix] handle oalesceValues panics when vals is nil via processImportValues (fix) handle oalesceValues panics when vals is nil via processImportValues fix: treat nil vals map as empty map to avoid panic --- pkg/chart/common/util/coalesce.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pkg/chart/common/util/coalesce.go b/pkg/chart/common/util/coalesce.go index 5994febbc..fc35ba8b1 100644 --- a/pkg/chart/common/util/coalesce.go +++ b/pkg/chart/common/util/coalesce.go @@ -19,6 +19,7 @@ package util import ( "fmt" "log" + "log/slog" "maps" "helm.sh/helm/v4/internal/copystructure" @@ -73,6 +74,13 @@ func MergeValues(chrt chart.Charter, vals map[string]any) (common.Values, error) } func copyValues(vals map[string]any) (common.Values, error) { + // handle case where vals is nil to avoid panics or misuse of an uninitialized values map + if vals == nil { + slog.Warn("copyValues called with nil vals; returning nil values map") + // ensure we always return a non-nil map to callers + return make(map[string]any), nil + } + v, err := copystructure.Copy(vals) if err != nil { return vals, err