Skip to content

Commit

Permalink
make a lenght comparison for intermediate struct
Browse files Browse the repository at this point in the history
  • Loading branch information
aomerk committed Oct 25, 2023
1 parent be9fa8b commit 22efeb2
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions clients/graphql/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down

0 comments on commit 22efeb2

Please sign in to comment.