Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Address NullPointerException crash in AztecHeadingSpan #1071

Merged
merged 1 commit into from
Dec 4, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,10 @@ open class AztecHeadingSpan(
// save original font metrics
if (previousFontMetrics == null) {
previousFontMetrics = Paint.FontMetricsInt()
previousFontMetrics!!.top = fm.top
previousFontMetrics!!.ascent = fm.ascent
previousFontMetrics!!.bottom = fm.bottom
previousFontMetrics!!.descent = fm.descent
previousFontMetrics?.top = fm.top
previousFontMetrics?.ascent = fm.ascent
previousFontMetrics?.bottom = fm.bottom
previousFontMetrics?.descent = fm.descent
fluiddot marked this conversation as resolved.
Show resolved Hide resolved
}

var addedTopPadding = false
Expand All @@ -151,13 +151,17 @@ open class AztecHeadingSpan(

// apply original font metrics to lines that should not have vertical padding
if (!addedTopPadding) {
fm.ascent = previousFontMetrics!!.ascent
fm.top = previousFontMetrics!!.top
previousFontMetrics?.let {
fm.ascent = it.ascent
fm.top = it.top
}
}

if (!addedBottomPadding) {
fm.descent = previousFontMetrics!!.descent
fluiddot marked this conversation as resolved.
Show resolved Hide resolved
fm.bottom = previousFontMetrics!!.bottom
previousFontMetrics?.let {
fm.descent = it.descent
fm.bottom = it.bottom
}
}
}

Expand Down
Loading