Skip to content

Commit

Permalink
Fix crash on iPad when no conversations are loaded
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisballinger committed Apr 21, 2015
1 parent 7ba4ecd commit c37a46a
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions ChatSecure/Classes/View Controllers/OTRMessagesViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,9 @@ - (void)setupLockButton

-(void)updateEncryptionState
{
if (!self.account) {
return;
}
[[OTRKit sharedInstance] checkIfGeneratingKeyForAccountName:self.account.username protocol:self.account.protocolTypeString completion:^(BOOL isGeneratingKey) {
if( isGeneratingKey) {
[self addLockSpinner];
Expand Down Expand Up @@ -1022,15 +1025,29 @@ - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSe

- (NSString *)senderDisplayName
{
if ([self.account.displayName length]) {
return self.account.displayName;
NSString *senderDisplayName = nil;
if (self.account) {
if ([self.account.displayName length]) {
senderDisplayName = self.account.displayName;
} else {
senderDisplayName = self.account.username;
}
} else {
senderDisplayName = @"";
}
return self.account.username;

return senderDisplayName;
}

- (NSString *)senderId
{
return self.account.uniqueId;
NSString *senderId = nil;
if (self.account) {
senderId = self.account.uniqueId;
} else {
senderId = @"";
}
return senderId;
}

- (id<JSQMessageData>)collectionView:(JSQMessagesCollectionView *)collectionView messageDataForItemAtIndexPath:(NSIndexPath *)indexPath
Expand Down

0 comments on commit c37a46a

Please sign in to comment.