From 6895dc6c6c64bcebbaf1ee5292125b6631008d97 Mon Sep 17 00:00:00 2001 From: Jonathan Rainville Date: Wed, 2 Jun 2021 11:44:24 -0400 Subject: [PATCH] fix: fix community crash when no chat is active Fixes #2628 --- src/app/chat/event_handling.nim | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/app/chat/event_handling.nim b/src/app/chat/event_handling.nim index 91694f8aa8..4ce0cf88b9 100644 --- a/src/app/chat/event_handling.nim +++ b/src/app/chat/event_handling.nim @@ -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):