We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c9f587a commit 803e7cbCopy full SHA for 803e7cb
MaterialTextField/MFTextField.m
@@ -498,7 +498,14 @@ - (void)updatePlaceholderColor
498
499
- (NSAttributedString *)attributedString:(NSAttributedString *)attributedString withColor:(UIColor *)color
500
{
501
- NSMutableDictionary *attributes = [[attributedString attributesAtIndex:0 effectiveRange:NULL] mutableCopy];
+ NSMutableDictionary *attributes;
502
+
503
+ if (attributedString.length > 0) {
504
+ attributes = [[attributedString attributesAtIndex:0 effectiveRange:NULL] mutableCopy];
505
+ }
506
+ else {
507
+ attributes = [NSMutableDictionary dictionary];
508
509
attributes[NSForegroundColorAttributeName] = color;
510
511
return [[NSAttributedString alloc] initWithString:attributedString.string attributes:attributes];
0 commit comments