File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -43,7 +43,9 @@ + (DTCoreTextParagraphStyle *)paragraphStyleWithCTParagraphStyle:(CTParagraphSty
4343#if DTCORETEXT_SUPPORT_NS_ATTRIBUTES
4444+ (DTCoreTextParagraphStyle *)paragraphStyleWithNSParagraphStyle : (NSParagraphStyle *)paragraphStyle
4545{
46- NSParameterAssert (paragraphStyle);
46+ if ( ! paragraphStyle) {
47+ paragraphStyle = [NSParagraphStyle defaultParagraphStyle ];
48+ }
4749
4850 DTCoreTextParagraphStyle *retStyle = [[DTCoreTextParagraphStyle alloc ] init ];
4951
Original file line number Diff line number Diff line change @@ -170,4 +170,16 @@ - (void)testAttributedStringColorToHTML
170170}
171171 */
172172
173+ - (void )testCrashAtEmptyNodeBeforeDivWithiOS6Attributes
174+ {
175+ // This string is the simplest case that caused the crash.
176+ NSString *html = @" <div><i></i><div></div></div>;" ;
177+ NSData *data = [html dataUsingEncoding: NSUTF8StringEncoding];
178+ NSDictionary *options = @{DTUseiOS6Attributes: @(YES )};
179+ NSAttributedString *string = [[NSAttributedString alloc ] initWithHTMLData: data
180+ options: options
181+ documentAttributes: NULL ];
182+ XCTAssert (string != nil );
183+ }
184+
173185@end
You can’t perform that action at this time.
0 commit comments