mirror of
https://github.com/opentofu/opentofu.git
synced 2024-12-24 16:10:46 -06:00
Fix panic in interpolate_walk
Verify that we have enough containers in the stack to look for a map in replaceCurrent.
This commit is contained in:
parent
3c41a7ca1e
commit
a111635908
@ -204,8 +204,8 @@ func TestConfigValidate_table(t *testing.T) {
|
||||
{
|
||||
"nested types in variable default",
|
||||
"validate-var-nested",
|
||||
true,
|
||||
"ERROR",
|
||||
false,
|
||||
"",
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -206,6 +206,12 @@ func (w *interpolationWalker) Primitive(v reflect.Value) error {
|
||||
}
|
||||
|
||||
func (w *interpolationWalker) replaceCurrent(v reflect.Value) {
|
||||
// if we don't have at least 2 values, we're not going to find a map, but
|
||||
// we could panic.
|
||||
if len(w.cs) < 2 {
|
||||
return
|
||||
}
|
||||
|
||||
c := w.cs[len(w.cs)-2]
|
||||
switch c.Kind() {
|
||||
case reflect.Map:
|
||||
|
Loading…
Reference in New Issue
Block a user