Fix infinite loop in decodeMap

This commit is contained in:
Mitchell Hashimoto 2014-08-11 21:49:12 -07:00
parent 1a9d040ea4
commit 21b17881bd
3 changed files with 17 additions and 4 deletions

View File

@ -199,6 +199,7 @@ func (d *decoder) decodeMap(name string, o *hcl.Object, result reflect.Value) er
current := o
for current != nil {
if current.Value == nil {
current = current.Next
continue
}

View File

@ -20,6 +20,17 @@ func TestDecode_interface(t *testing.T) {
"foo": "bar",
},
},
{
"empty.hcl",
false,
map[string]interface{}{
"resource": map[string]interface{}{
"aws_instance": map[string]interface{}{
"db": map[string]interface{}{},
},
},
},
},
/*
{
"structure.hcl",
@ -67,10 +78,10 @@ func TestDecode_equal(t *testing.T) {
"basic.json",
},
/*
{
"structure.hcl",
"structure.json",
},
{
"structure.hcl",
"structure.json",
},
*/
{
"structure.hcl",

1
test-fixtures/empty.hcl Normal file
View File

@ -0,0 +1 @@
resource "aws_instance" "db" {}