From fc57cf42f20effdde61e0dfad4fe96f622e4350e Mon Sep 17 00:00:00 2001 From: Derek Horton Date: Tue, 20 Feb 2024 13:33:08 -0600 Subject: [PATCH] Check for nil pointer in the sources client --- internal/api/connectors/sources/impl.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/internal/api/connectors/sources/impl.go b/internal/api/connectors/sources/impl.go index b3a62c9a..ad9adadd 100644 --- a/internal/api/connectors/sources/impl.go +++ b/internal/api/connectors/sources/impl.go @@ -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)) @@ -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{