Fix infinite loop in decodeMap
This commit is contained in:
parent
1a9d040ea4
commit
21b17881bd
@ -199,6 +199,7 @@ func (d *decoder) decodeMap(name string, o *hcl.Object, result reflect.Value) er
|
|||||||
current := o
|
current := o
|
||||||
for current != nil {
|
for current != nil {
|
||||||
if current.Value == nil {
|
if current.Value == nil {
|
||||||
|
current = current.Next
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,6 +20,17 @@ func TestDecode_interface(t *testing.T) {
|
|||||||
"foo": "bar",
|
"foo": "bar",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"empty.hcl",
|
||||||
|
false,
|
||||||
|
map[string]interface{}{
|
||||||
|
"resource": map[string]interface{}{
|
||||||
|
"aws_instance": map[string]interface{}{
|
||||||
|
"db": map[string]interface{}{},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
/*
|
/*
|
||||||
{
|
{
|
||||||
"structure.hcl",
|
"structure.hcl",
|
||||||
@ -67,10 +78,10 @@ func TestDecode_equal(t *testing.T) {
|
|||||||
"basic.json",
|
"basic.json",
|
||||||
},
|
},
|
||||||
/*
|
/*
|
||||||
{
|
{
|
||||||
"structure.hcl",
|
"structure.hcl",
|
||||||
"structure.json",
|
"structure.json",
|
||||||
},
|
},
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
"structure.hcl",
|
"structure.hcl",
|
||||||
|
1
test-fixtures/empty.hcl
Normal file
1
test-fixtures/empty.hcl
Normal file
@ -0,0 +1 @@
|
|||||||
|
resource "aws_instance" "db" {}
|
Loading…
Reference in New Issue
Block a user