From 82df90c02b7736236e861ec90f0c93290d43b5eb Mon Sep 17 00:00:00 2001 From: elijahstorm <95153181+elijahstorm@users.noreply.github.com> Date: Sun, 20 Oct 2024 17:16:09 +0900 Subject: [PATCH] pre-check for null leg --- internal/localsvc/svc.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/internal/localsvc/svc.go b/internal/localsvc/svc.go index 08567315..8b655eb5 100644 --- a/internal/localsvc/svc.go +++ b/internal/localsvc/svc.go @@ -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,