From 882453dd18da6cfb22eec338381a04dd80f9a54a Mon Sep 17 00:00:00 2001 From: Salim Afiune Maya Date: Mon, 23 Dec 2024 07:47:21 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20ms365:=20check=20error=20before?= =?UTF-8?q?=20accessing=20resp?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Salim Afiune Maya --- providers/ms365/resources/applications.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/providers/ms365/resources/applications.go b/providers/ms365/resources/applications.go index d88da0ce38..773123fcd8 100644 --- a/providers/ms365/resources/applications.go +++ b/providers/ms365/resources/applications.go @@ -8,10 +8,11 @@ import ( "encoding/base64" "errors" "fmt" - "github.com/rs/zerolog/log" "net/url" "time" + "github.com/rs/zerolog/log" + "github.com/microsoftgraph/msgraph-sdk-go/applications" "github.com/microsoftgraph/msgraph-sdk-go/models" "github.com/microsoftgraph/msgraph-sdk-go/serviceprincipals" @@ -253,6 +254,10 @@ func (a *mqlMicrosoftApplication) servicePrincipal() (*mqlMicrosoftServiceprinci Filter: &filter, }, }) + if err != nil { + return nil, err + } + servicePrincipals := resp.GetValue() if len(servicePrincipals) == 0 { return nil, errors.New("service principal not found")