Permalink
Browse files

Handle a nil font being set for TUIAttributedString

  • Loading branch information...
1 parent 608c042 commit c9b7cfc66e25928f5ce3b40b99d9d4130793fb9b Justin Spahr-Summers committed Jul 26, 2012
Showing with 6 additions and 2 deletions.
  1. +6 −2 lib/UIKit/TUIAttributedString.m
@@ -39,8 +39,12 @@ - (NSRange)_stringRange
- (void)setFont:(NSFont *)font inRange:(NSRange)range
{
- // NSFont and CTFont are toll-free bridged.
- [self addAttribute:(NSString *)kCTFontAttributeName value:font range:range];
+ if (font != nil) {
+ // NSFont and CTFont are toll-free bridged.
+ [self addAttribute:(NSString *)kCTFontAttributeName value:font range:range];
+ } else {
+ [self removeAttribute:(NSString *)kCTFontAttributeName range:range];
+ }
}
- (void)setColor:(TUIColor *)color inRange:(NSRange)range

0 comments on commit c9b7cfc

Please sign in to comment.