fix: fix community crash when no chat is active

Fixes #2628
This commit is contained in:
Jonathan Rainville 2021-06-02 11:44:24 -04:00 committed by Iuri Matias
parent 20bbf97787
commit 6895dc6c6c
1 changed files with 3 additions and 2 deletions

View File

@ -42,8 +42,9 @@ proc handleChatEvents(self: ChatController) =
for community in evArgs.communities:
self.view.communities.addCommunityToList(community)
if (self.view.communities.activeCommunity.active and self.view.communities.activeCommunity.communityItem.id == community.id):
let communityChannel = self.view.communities.activeCommunity.chats.getChannelById(self.view.activeChannel.chatItem.id)
self.view.activeChannel.chatItem.canPost = communityChannel.canPost
if (self.view.activeChannel.chatItem != nil):
let communityChannel = self.view.communities.activeCommunity.chats.getChannelById(self.view.activeChannel.chatItem.id)
self.view.activeChannel.chatItem.canPost = communityChannel.canPost
self.view.activeChannelChanged()
if (evArgs.communityMembershipRequests.len > 0):