From 22efeb2f1a3d42447ebfcc337211fc55745d646f Mon Sep 17 00:00:00 2001 From: ali Date: Wed, 25 Oct 2023 20:14:44 +0300 Subject: [PATCH] make a lenght comparison for intermediate struct --- clients/graphql/client.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/clients/graphql/client.go b/clients/graphql/client.go index 053d5dcf..0c59dcde 100644 --- a/clients/graphql/client.go +++ b/clients/graphql/client.go @@ -180,6 +180,9 @@ func parseResponse(responseBody []byte) (*graphql.Response, *GetAlertsResponse, return nil, nil, err } + if len(data.Alerts.Alerts) != len(temp.Alerts.Alerts) { + return nil, nil, fmt.Errorf("incorrect unmarshal for intermediate graphql struct") + } for i := range data.Alerts.Alerts { tmpAlert := temp.Alerts.Alerts[i].Source.SourceAlert data.Alerts.Alerts[i].Source.SourceEvent = &protocol.AlertEvent_Alert_SourceAlertEvent{