Skip to content

Commit

Permalink
🐛 ms365: check error before accessing resp
Browse files Browse the repository at this point in the history
Signed-off-by: Salim Afiune Maya <[email protected]>
  • Loading branch information
afiune committed Dec 23, 2024
1 parent 916c468 commit 882453d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion providers/ms365/resources/applications.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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")
Expand Down

0 comments on commit 882453d

Please sign in to comment.