File tree Expand file tree Collapse file tree 1 file changed +12
-8
lines changed
aztec/src/main/kotlin/org/wordpress/aztec/spans Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -127,10 +127,10 @@ open class AztecHeadingSpan(
127127 // save original font metrics
128128 if (previousFontMetrics == null ) {
129129 previousFontMetrics = Paint .FontMetricsInt ()
130- previousFontMetrics!! .top = fm.top
131- previousFontMetrics!! .ascent = fm.ascent
132- previousFontMetrics!! .bottom = fm.bottom
133- previousFontMetrics!! .descent = fm.descent
130+ previousFontMetrics? .top = fm.top
131+ previousFontMetrics? .ascent = fm.ascent
132+ previousFontMetrics? .bottom = fm.bottom
133+ previousFontMetrics? .descent = fm.descent
134134 }
135135
136136 var addedTopPadding = false
@@ -151,13 +151,17 @@ open class AztecHeadingSpan(
151151
152152 // apply original font metrics to lines that should not have vertical padding
153153 if (! addedTopPadding) {
154- fm.ascent = previousFontMetrics!! .ascent
155- fm.top = previousFontMetrics!! .top
154+ previousFontMetrics?.let {
155+ fm.ascent = it.ascent
156+ fm.top = it.top
157+ }
156158 }
157159
158160 if (! addedBottomPadding) {
159- fm.descent = previousFontMetrics!! .descent
160- fm.bottom = previousFontMetrics!! .bottom
161+ previousFontMetrics?.let {
162+ fm.descent = it.descent
163+ fm.bottom = it.bottom
164+ }
161165 }
162166 }
163167
You can’t perform that action at this time.
0 commit comments