@@ -106,9 +106,11 @@ extension UILabel: SkeletonTextNode {
106106 }
107107
108108 var fontLineHeight : CGFloat ? {
109- if let attributes = attributedText? . attributes ( at: 0 , effectiveRange: nil ) ,
110- let fontAttribute = attributes. first ( where: { $0. key == . font } ) {
111- return fontAttribute. value as? CGFloat ?? font. lineHeight
109+ if let attributedText = attributedText,
110+ attributedText. length > 0 {
111+ let attributes = attributedText. attributes ( at: 0 , effectiveRange: nil )
112+ let fontAttribute = attributes. first ( where: { $0. key == . font } )
113+ return fontAttribute? . value as? CGFloat ?? font. lineHeight
112114 } else {
113115 return font. lineHeight
114116 }
@@ -179,9 +181,11 @@ extension UITextView: SkeletonTextNode {
179181 }
180182
181183 var fontLineHeight : CGFloat ? {
182- if let attributes = attributedText? . attributes ( at: 0 , effectiveRange: nil ) ,
183- let fontAttribute = attributes. first ( where: { $0. key == . font } ) {
184- return fontAttribute. value as? CGFloat ?? font? . lineHeight
184+ if let attributedText = attributedText,
185+ attributedText. length > 0 {
186+ let attributes = attributedText. attributes ( at: 0 , effectiveRange: nil )
187+ let fontAttribute = attributes. first ( where: { $0. key == . font } )
188+ return fontAttribute? . value as? CGFloat ?? font? . lineHeight
185189 } else {
186190 return font? . lineHeight
187191 }
0 commit comments