Check nullability on attributed text

This commit is contained in:
aringenbach
2022-05-13 17:02:56 +02:00
parent 9e4b5baaf7
commit f8430d7c62

View File

@@ -167,11 +167,16 @@ static const NSTimeInterval kActionMenuComposerHeightAnimationDuration = .3;
- (void)setAttributedTextMessage:(NSAttributedString *)attributedTextMessage
{
NSMutableAttributedString *mutableTextMessage = [[NSMutableAttributedString alloc] initWithAttributedString:attributedTextMessage];
[mutableTextMessage addAttributes:@{ NSForegroundColorAttributeName: ThemeService.shared.theme.textPrimaryColor,
NSFontAttributeName: self.textDefaultFont }
range:NSMakeRange(0, mutableTextMessage.length)];
self.textView.attributedText = mutableTextMessage;
if (attributedTextMessage)
{
NSMutableAttributedString *mutableTextMessage = [[NSMutableAttributedString alloc] initWithAttributedString:attributedTextMessage];
[mutableTextMessage addAttributes:@{ NSForegroundColorAttributeName: ThemeService.shared.theme.textPrimaryColor,
NSFontAttributeName: self.textDefaultFont }
range:NSMakeRange(0, mutableTextMessage.length)];
attributedTextMessage = mutableTextMessage;
}
self.textView.attributedText = attributedTextMessage;
[self updateUIWithAttributedTextMessage:attributedTextMessage animated:YES];
[self textViewDidChange:self.textView];
}