If they set attributedString to nil twice, ignore the second one.

This commit is contained in:
Adlai Holler
2016-01-20 14:00:46 -08:00
parent 3aceabbbf9
commit db18724d5b

View File

@@ -336,14 +336,14 @@ static NSArray *DefaultLinkAttributeNames = @[ NSLinkAttributeName ];
- (void)setAttributedString:(NSAttributedString *)attributedString - (void)setAttributedString:(NSAttributedString *)attributedString
{ {
if (ASObjectIsEqual(attributedString, _attributedString)) {
return;
}
if (attributedString == nil) { if (attributedString == nil) {
attributedString = [[NSAttributedString alloc] initWithString:@"" attributes:nil]; attributedString = [[NSAttributedString alloc] initWithString:@"" attributes:nil];
} }
if (ASObjectIsEqual(attributedString, _attributedString)) {
return;
}
_attributedString = ASCleanseAttributedStringOfCoreTextAttributes(attributedString); _attributedString = ASCleanseAttributedStringOfCoreTextAttributes(attributedString);
// Sync the truncation string with attributes from the updated _attributedString // Sync the truncation string with attributes from the updated _attributedString