From bf89042e7b86add3c67b58697387def01a0eb3ce Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Mon, 11 Aug 2014 21:11:00 -0700 Subject: [PATCH] hcl: Elem on nil should return nil --- hcl/object.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hcl/object.go b/hcl/object.go index 6a35458..3c321db 100644 --- a/hcl/object.go +++ b/hcl/object.go @@ -71,6 +71,10 @@ func (o *Object) Elem(expand bool) []*Object { switch o.Type { case ValueTypeObject: + if o.Value == nil { + return nil + } + return o.Value.([]*Object) }