Skip to content

Commit

Permalink
pre-check for null leg
Browse files Browse the repository at this point in the history
  • Loading branch information
elijahstorm authored and aybabtme committed Oct 20, 2024
1 parent ab56e57 commit 75f38c9
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions internal/localsvc/svc.go
Original file line number Diff line number Diff line change
Expand Up @@ -286,14 +286,16 @@ func (svc *Service) WatchQuery(ctx context.Context, req *connect.Request[qrv1.Wa
case leg := <-legc:
// try to append to an existing LEG first
for _, eleg := range legs {
if eleg.MachineId == leg.MachineId &&
if eleg != nil && leg != nil && eleg.MachineId == leg.MachineId &&
eleg.SessionId == leg.SessionId {
eleg.Logs = append(eleg.Logs, leg.Logs...)
continue wait_for_more_leg
}
}
// didn't have an existing LEG for it, add it
legs = append(legs, leg)
if leg != nil {
legs = append(legs, leg)
}
case <-sender.C:
err := stream.Send(&qrv1.WatchQueryResponse{
Events: legs,
Expand Down

0 comments on commit 75f38c9

Please sign in to comment.