Skip to content

Commit

Permalink
test: Add null check for previousFontMetrics
Browse files Browse the repository at this point in the history
  • Loading branch information
Siobhan committed Dec 1, 2023
1 parent 1dca631 commit e05c8af
Showing 1 changed file with 18 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -156,15 +156,27 @@ 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
Log.d("TESTING 101", "chooseHeight is called, addedTopPadding")
previousFontMetrics?.let {
fm.ascent = it.ascent
fm.top = it.top
} ?: run {
// Handle the case where previousFontMetrics is null
Log.e("TESTING 101", "previousFontMetrics is null when processing top padding")
// Optionally, initialize previousFontMetrics here or take other corrective action
return
}
}

if (!addedBottomPadding) {
fm.descent = previousFontMetrics!!.descent
fm.bottom = previousFontMetrics!!.bottom
Log.d("TESTING 101", "chooseHeight is called, addedBottomPadding")
previousFontMetrics?.let {
fm.descent = it.descent
fm.bottom = it.bottom
} ?: run {
// Handle the case where previousFontMetrics is null
Log.e("TESTING 101", "previousFontMetrics is null when processing bottom padding")
// Optionally, initialize previousFontMetrics here or take other corrective action
return
}
}
}

Expand Down

0 comments on commit e05c8af

Please sign in to comment.