diff --git a/d2layouts/d2layouts.go b/d2layouts/d2layouts.go index aeabf7770..dcd3b4ac3 100644 --- a/d2layouts/d2layouts.go +++ b/d2layouts/d2layouts.go @@ -315,6 +315,9 @@ func InjectNested(container *d2graph.Object, nestedGraph *d2graph.Graph, isRoot g := container.Graph for _, obj := range nestedGraph.Root.ChildrenArray { obj.Parent = container + if container.Children == nil { + container.Children = make(map[string]*d2graph.Object) + } container.Children[strings.ToLower(obj.ID)] = obj container.ChildrenArray = append(container.ChildrenArray, obj) }