Skip to content

Commit

Permalink
additional fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
caffix committed Oct 18, 2024
1 parent 5ea1ae4 commit 1f93172
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions cmd/oam_assoc/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,9 @@ func getAssociations(name string, since time.Time, db *assetdb.AssetDB) []string
for _, fqdn := range fqdns {
if rels, err := db.OutgoingRelations(fqdn, since, "registration"); err == nil && len(rels) > 0 {
for _, rel := range rels {
assets = append(assets, rel.ToAsset)
if a, err := db.FindById(rel.ToAsset.ID, since); err == nil && a != nil {
assets = append(assets, a)
}
}
}
}
Expand All @@ -189,7 +191,10 @@ func getAssociations(name string, since time.Time, db *assetdb.AssetDB) []string
for _, a := range assets {
if rels, err := db.OutgoingRelations(a, since, "associated_with"); err == nil && len(rels) > 0 {
for _, rel := range rels {
asset := rel.ToAsset
asset, err := db.FindById(rel.ToAsset.ID, since)
if err != nil || asset == nil {
continue
}

if !set.Has(asset.ID) {
set.Insert(asset.ID)
Expand Down

0 comments on commit 1f93172

Please sign in to comment.