Skip to content

Commit 768810b

Browse files
committed
fix: enhance error handling in FillMissingKeys for stateMap conversion
1 parent dd27656 commit 768810b

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

core/dbio/iop/transforms.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -830,7 +830,13 @@ func (e *Evaluator) FillMissingKeys(stateMap map[string]any, varsToCheck []strin
830830
stateMap[section] = g.M()
831831
}
832832

833-
nested := cast.ToStringMap(stateMap[section])
833+
nested, err := cast.ToStringMapE(stateMap[section])
834+
if err != nil {
835+
g.Warn("could not convert to map to fill missing key for %s: %#v", section, stateMap[section])
836+
nested = g.M()
837+
} else if nested == nil {
838+
nested = g.M()
839+
}
834840
if _, ok := nested[key]; !ok {
835841
nested[key] = nil
836842
}

0 commit comments

Comments
 (0)