From 246ae7af1885f159ae9e72879bf3f06e033699d4 Mon Sep 17 00:00:00 2001 From: Gautier Pelloux-Prayer Date: Wed, 15 Jul 2015 13:37:58 +0200 Subject: [PATCH] ChatRoomViewController.m: crash if failing to set display name in composing message --- Classes/ChatRoomViewController.m | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Classes/ChatRoomViewController.m b/Classes/ChatRoomViewController.m index 40ed4a661..4a03c94c5 100644 --- a/Classes/ChatRoomViewController.m +++ b/Classes/ChatRoomViewController.m @@ -248,8 +248,10 @@ static UICompositeViewDescription *compositeDescription = nil; displayName = [NSString stringWithUTF8String:username ?: address]; ms_free(address); } - [addressLabel setText:displayName]; - [addressLabel setAccessibilityValue:displayName]; + if (displayName == nil) + LOGF(@"No display name"); + addressLabel.text = displayName; + addressLabel.accessibilityValue = displayName; // Avatar if (image == nil) { @@ -350,8 +352,8 @@ static void message_status(LinphoneChatMessage *msg, LinphoneChatMessageState st CGRect newTableFrame = [self.tableController.tableView frame]; if (visible) { - [composeLabel - setText:[NSString stringWithFormat:NSLocalizedString(@"%@ is composing...", @""), [addressLabel text]]]; + composeLabel.text = + [NSString stringWithFormat:NSLocalizedString(@"%@ is composing...", nil), addressLabel.text]; // pull up the composing frame and shrink the table view newTableFrame.size.height -= newComposingFrame.size.height;