fix: check nil pointer in saveProfileShowcasePreferencesProto (#4821)

This commit is contained in:
Igor Sirotin 2024-02-28 11:36:13 +00:00 committed by GitHub
parent 9fef2d3558
commit f0dcc60a17
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 1 deletions

View File

@ -181,7 +181,9 @@ func (m *Messenger) handleBackedUpProfile(message *protobuf.BackedUpProfile, bac
if err != nil {
return err
}
response.SetProfileShowcasePreferences(profileShowcasePreferences)
if profileShowcasePreferences != nil {
response.SetProfileShowcasePreferences(profileShowcasePreferences)
}
var ensUsernameDetails []*ensservice.UsernameDetail
for _, d := range message.EnsUsernameDetails {

View File

@ -669,6 +669,9 @@ func (m *Messenger) DeleteProfileShowcaseCommunity(community *communities.Commun
}
func (m *Messenger) saveProfileShowcasePreferencesProto(p *protobuf.SyncProfileShowcasePreferences, shouldSync bool) (*identity.ProfileShowcasePreferences, error) {
if p == nil {
return nil, nil
}
preferences := FromProfileShowcasePreferencesProto(p)
return preferences, m.setProfileShowcasePreferences(preferences, shouldSync)
}