@@ -135,8 +135,11 @@ type SectionHandler func(sectionKey string, parentPath string, parent *jwcc.Obje
135135
136136func handleArray () SectionHandler {
137137 return func (sectionKey string , parentPath string , parent * jwcc.Object , childPath string , childSection * jwcc.Member ) {
138+ if childSection == nil {
139+ return
140+ }
138141 parentProps := parent .FindKey (ast .TextEqual (sectionKey ))
139- if parentProps != nil {
142+ if parentProps != nil && len ( parentProps . Value .( * jwcc. Array ). Values ) > 0 {
140143 pathComment (parentProps .Value .(* jwcc.Array ).Values [0 ], parentPath )
141144 }
142145
@@ -160,6 +163,9 @@ func handleArray() SectionHandler {
160163
161164func handleObject () SectionHandler {
162165 return func (sectionKey string , parentPath string , parent * jwcc.Object , childPath string , childSection * jwcc.Member ) {
166+ if childSection == nil {
167+ return
168+ }
163169 parentProps := parent .FindKey (ast .TextEqual (sectionKey ))
164170 if parentProps != nil {
165171 pathComment (parentProps .Value .(* jwcc.Object ).Members [0 ], parentPath )
@@ -185,6 +191,9 @@ func handleObject() SectionHandler {
185191func handleAutoApprovers () SectionHandler {
186192 // https://tailscale.com/kb/1337/acl-syntax#auto-approvers-autoapprovers
187193 return func (sectionKey string , parentPath string , parent * jwcc.Object , childPath string , childSection * jwcc.Member ) {
194+ if childSection == nil {
195+ return
196+ }
188197 newObj := existingOrNewObject (* parent , sectionKey )
189198
190199 childSectionObj := childSection .Value .(* jwcc.Object )
0 commit comments