From 81b019c94ff19d844d993e8f7dd42741c4de2775 Mon Sep 17 00:00:00 2001 From: nielsandriesse Date: Wed, 30 Sep 2020 10:13:49 +1000 Subject: [PATCH] Fix crash --- .../OWSConversationSettingsViewController.m | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Signal/src/ViewControllers/ThreadSettings/OWSConversationSettingsViewController.m b/Signal/src/ViewControllers/ThreadSettings/OWSConversationSettingsViewController.m index 094e1d325..68335302c 100644 --- a/Signal/src/ViewControllers/ThreadSettings/OWSConversationSettingsViewController.m +++ b/Signal/src/ViewControllers/ThreadSettings/OWSConversationSettingsViewController.m @@ -649,11 +649,13 @@ const CGFloat kIconViewLength = 24; // Group settings section. - __block BOOL isUserMember; - NSString *userPublicKey = OWSIdentityManager.sharedManager.identityKeyPair.hexEncodedPublicKey; - [LKStorage readWithBlock:^(YapDatabaseReadTransaction *transaction) { - isUserMember = [(TSGroupThread *)self.thread isUserMemberInGroup:userPublicKey transaction:transaction]; - }]; + __block BOOL isUserMember = NO; + if (self.isGroupThread) { + NSString *userPublicKey = OWSIdentityManager.sharedManager.identityKeyPair.hexEncodedPublicKey; + [LKStorage readWithBlock:^(YapDatabaseReadTransaction *transaction) { + isUserMember = [(TSGroupThread *)self.thread isUserMemberInGroup:userPublicKey transaction:transaction]; + }]; + } if (self.isGroupThread && self.isPrivateGroupChat && isUserMember) { if (((TSGroupThread *)self.thread).usesSharedSenderKeys) {