Fix panic in GroupByID call (#4778)
`resp` is nil if there's an error and `getGroupFromResponse` will panic. --- #### Does this PR need a docs update or release note? - [ ] ✅ Yes, it's included - [ ] 🕐 Yes, but in a later PR - [x] ⛔ No #### Type of change <!--- Please check the type of change your PR introduces: ---> - [ ] 🌻 Feature - [x] 🐛 Bugfix - [ ] 🗺️ Documentation - [ ] 🤖 Supportability/Tests - [ ] 💻 CI/Deployment - [ ] 🧹 Tech Debt/Cleanup #### Issue(s) <!-- Can reference multiple issues. Use one of the following "magic words" - "closes, fixes" to auto-close the Github issue. --> * #<issue> #### Test Plan <!-- How will this be tested prior to merging.--> - [x] 💪 Manual - [ ] ⚡ Unit test - [ ] 💚 E2E
This commit is contained in:
parent
37dcb952fb
commit
5a77db656e
@ -150,7 +150,10 @@ func (c Groups) GetByID(
|
||||
}
|
||||
|
||||
resp, err := service.Client().Groups().Get(ctx, opts)
|
||||
if err != nil {
|
||||
if err == nil {
|
||||
return getGroupFromResponse(ctx, resp)
|
||||
}
|
||||
|
||||
if graph.IsErrResourceLocked(err) {
|
||||
err = clues.Stack(graph.ErrResourceLocked, err)
|
||||
}
|
||||
@ -158,9 +161,6 @@ func (c Groups) GetByID(
|
||||
logger.CtxErr(ctx, err).Info("finding group by email, falling back to display name")
|
||||
}
|
||||
|
||||
return getGroupFromResponse(ctx, resp)
|
||||
}
|
||||
|
||||
// fall back to display name
|
||||
opts := &groups.GroupsRequestBuilderGetRequestConfiguration{
|
||||
Headers: newEventualConsistencyHeaders(),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user