Skip to content

Commit

Permalink
Merge branch 'mandersen-ios6-empty-node-crash' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
odrobnik committed Feb 14, 2015
2 parents 620194a + 0deed07 commit feccd72
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Core/Source/DTCoreTextParagraphStyle.m
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ + (DTCoreTextParagraphStyle *)paragraphStyleWithCTParagraphStyle:(CTParagraphSty
#if DTCORETEXT_SUPPORT_NS_ATTRIBUTES
+ (DTCoreTextParagraphStyle *)paragraphStyleWithNSParagraphStyle:(NSParagraphStyle *)paragraphStyle
{
NSParameterAssert(paragraphStyle);
if ( ! paragraphStyle) {
paragraphStyle = [NSParagraphStyle defaultParagraphStyle];
}

DTCoreTextParagraphStyle *retStyle = [[DTCoreTextParagraphStyle alloc] init];

Expand Down
12 changes: 12 additions & 0 deletions Test/Source/NSAttributedStringHTMLTest.m
Original file line number Diff line number Diff line change
Expand Up @@ -170,4 +170,16 @@ - (void)testAttributedStringColorToHTML
}
*/

- (void)testCrashAtEmptyNodeBeforeDivWithiOS6Attributes
{
// This string is the simplest case that caused the crash.
NSString *html = @"<div><i></i><div></div></div>;";
NSData *data = [html dataUsingEncoding:NSUTF8StringEncoding];
NSDictionary *options = @{DTUseiOS6Attributes: @(YES)};
NSAttributedString *string = [[NSAttributedString alloc] initWithHTMLData:data
options:options
documentAttributes:NULL];
XCTAssert(string != nil);
}

@end

0 comments on commit feccd72

Please sign in to comment.