Skip to content

Commit

Permalink
Check for nil pointer in the sources client
Browse files Browse the repository at this point in the history
  • Loading branch information
dehort committed Feb 20, 2024
1 parent 8311244 commit fc57cf4
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions internal/api/connectors/sources/impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,10 @@ func (this *sourcesClientImpl) GetSourceConnectionDetails(ctx context.Context, s
return SourceConnectionStatus{}, err
}

if sourcesResponse == nil {
return SourceConnectionStatus{}, fmt.Errorf("GetSources returned an empty response")
}

source := (*sourcesResponse)[0]

rhcConnectionResponse, err := this.getRHCConnectionStatus(ctx, string(*source.Id))
Expand All @@ -142,6 +146,10 @@ func (this *sourcesClientImpl) GetSourceConnectionDetails(ctx context.Context, s
return SourceConnectionStatus{}, err
}

if rhcConnectionResponse == nil || rhcConnectionResponse.Data == nil {
return SourceConnectionStatus{}, fmt.Errorf("GetRHCConnectionStatus returned an empty response")
}

rhcInfo := (*rhcConnectionResponse).Data

return SourceConnectionStatus{
Expand Down

0 comments on commit fc57cf4

Please sign in to comment.