Fix potential unknown selector exception

This commit is contained in:
Sebastián Katzer 2019-03-01 17:48:52 +01:00
parent 9362e4c341
commit 9cbb6b8f9a

View File

@ -57,11 +57,12 @@
+ (UIPrintFormatter *) configureFormatter:(UIPrintFormatter *)formatter
withSettings:(NSDictionary *)settings
{
id layout = [[self alloc] initWithDictionary:settings];
id layout = [[self alloc] initWithDictionary:settings];
SEL setFont = NSSelectorFromString(@"font");
[layout configureFormatter:formatter];
if (settings && ![formatter isKindOfClass:UIMarkupTextPrintFormatter.class])
if (settings && [formatter respondsToSelector:setFont])
{
[layout configureTextFormatter:(UISimpleTextPrintFormatter *)formatter
withSettings:settings];