Skip to content

Commit

Permalink
Catch edgecase
Browse files Browse the repository at this point in the history
  • Loading branch information
micahlmartin committed Oct 19, 2021
1 parent 5c6833a commit 1aead74
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions harness/api/cac.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ func FindConfigAsCodeItemByPath(rootItem *cac.ConfigAsCodeItem, path cac.YamlPat
}

for _, item := range rootItem.Children {
if item == nil {
continue
}

if matchingItem := FindConfigAsCodeItemByPath(item, path); matchingItem != nil {
return matchingItem
}
Expand All @@ -44,6 +48,11 @@ func FindConfigAsCodeItemByUUID(rootItem *cac.ConfigAsCodeItem, uuid string) *ca
}

for _, item := range rootItem.Children {
// There's a strange edgecase where child items are nil
if item == nil {
continue
}

if matchingItem := FindConfigAsCodeItemByUUID(item, uuid); matchingItem != nil {
return matchingItem
}
Expand Down

0 comments on commit 1aead74

Please sign in to comment.