Skip to content

Commit

Permalink
update textBounds if text is null
Browse files Browse the repository at this point in the history
  • Loading branch information
westnordost committed Sep 8, 2020
1 parent 74697d4 commit db2bcc5
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ class VerticalLabelView @JvmOverloads constructor(
}

override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {
text?.let {
textPaint.getTextBounds(it, 0, it.length ?: 0, textBounds)
text.let {
textPaint.getTextBounds(it, 0, it?.length ?: 0, textBounds)
}

val desiredWidth = textBounds.height() + paddingLeft + paddingRight
Expand Down

0 comments on commit db2bcc5

Please sign in to comment.