fix crash when viewing undisplayable text

(can't init attributed string with nil)

// FREEBIE
pull/1/head
Michael Kirk 8 years ago
parent 572c1e3d80
commit 2f05dcc2c5

@ -98,15 +98,19 @@ NS_ASSUME_NONNULL_BEGIN
: [UIColor lightGrayColor]),
}]];
}
[snippetText appendAttributedString:[[NSAttributedString alloc] initWithString:[[DisplayableTextFilter new] displayableText:thread.lastMessageLabel]
attributes:@{
NSFontAttributeName : (thread.hasUnreadMessages
? [UIFont ows_mediumFontWithSize:12]
: [UIFont ows_regularFontWithSize:12]),
NSForegroundColorAttributeName : (thread.hasUnreadMessages
? [UIColor ows_blackColor]
: [UIColor lightGrayColor]),
}]];
NSString *displayableText = [[DisplayableTextFilter new] displayableText:thread.lastMessageLabel];
if (displayableText) {
[snippetText appendAttributedString:[[NSAttributedString alloc]
initWithString:displayableText
attributes:@{
NSFontAttributeName : (thread.hasUnreadMessages
? [UIFont ows_mediumFontWithSize:12]
: [UIFont ows_regularFontWithSize:12]),
NSForegroundColorAttributeName :
(thread.hasUnreadMessages ? [UIColor ows_blackColor]
: [UIColor lightGrayColor]),
}]];
}
}
NSAttributedString *attributedDate = [self dateAttributedString:thread.lastMessageDate];

Loading…
Cancel
Save