serving/xrefs.Edges: don't add nil node to map
Summary: Guard against adding a nil node (one with no facts matched by the requested filters) to the returned map.
Reviewers: zarko, #core_team, fromberger
Subscribers: fromberger, #core_team
@@ -417,7 +417,9 @@ func (t *Table) edges(ctx context.Context, req edgesRequest) (*gpb.EdgesReply, e
if len(patterns) > 0 && !nodeTickets.Contains(pes.Source.Ticket) {
nodeTickets.Add(pes.Source.Ticket)
- reply.Nodes[pes.Source.Ticket] = nodeToInfo(patterns, pes.Source)
+ if info := nodeToInfo(patterns, pes.Source); info != nil {
+ reply.Nodes[pes.Source.Ticket] = info
+ }
}
}
}
