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(
127
127
// save original font metrics
128
128
if (previousFontMetrics == null ) {
129
129
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
134
134
}
135
135
136
136
var addedTopPadding = false
@@ -151,13 +151,17 @@ open class AztecHeadingSpan(
151
151
152
152
// apply original font metrics to lines that should not have vertical padding
153
153
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
+ }
156
158
}
157
159
158
160
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
+ }
161
165
}
162
166
}
163
167
You can’t perform that action at this time.
0 commit comments