Fix possible panic in contacts fetch (#5205)

We were not checking for the error returned by the Get method before trying to use the result to get contact info.

<!-- PR description-->

---

#### 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:
Abin Simon 2024-02-10 13:27:57 +05:30 committed by GitHub
parent f92f811559
commit f0b8041c3f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -186,8 +186,11 @@ func (c Contacts) GetItem(
Contacts(). Contacts().
ByContactId(itemID). ByContactId(itemID).
Get(ctx, options) Get(ctx, options)
if err != nil {
return nil, nil, clues.Stack(err)
}
return cont, ContactInfo(cont), clues.Stack(err).OrNil() return cont, ContactInfo(cont), nil
} }
func (c Contacts) PostItem( func (c Contacts) PostItem(