added nil checking for communitiesManager.GetByID (#3877)

This commit is contained in:
frank 2023-08-11 19:17:34 +08:00 committed by GitHub
parent 8b9ee803e2
commit daa9ad4e05
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 1 deletions

View File

@ -1 +1 @@
0.163.4
0.163.5

View File

@ -3024,6 +3024,9 @@ func (m *Manager) GetByID(id []byte) (*Community, error) {
if err != nil {
return nil, err
}
if community == nil {
return nil, nil
}
err = community.updateCommunityDescriptionByEvents()
if err != nil {

View File

@ -2803,6 +2803,12 @@ func (s *MessengerCommunitiesSuite) TestCheckCommunitiesToUnmute() {
}
func (s *MessengerCommunitiesSuite) TestCommunityNotInDB() {
community, err := s.alice.communitiesManager.GetByID([]byte("0x123"))
s.Require().Nil(err)
s.Require().Nil(community)
}
func (s *MessengerCommunitiesSuite) TestMuteAllCommunityChats() {
// Create a community
createCommunityReq := &requests.CreateCommunity{